From 52f3dee16a81ca4ed4d3a5a12e5f4fbf74cc3ddb Mon Sep 17 00:00:00 2001
From: wm4 <wm4@nowhere>
Date: Fri, 11 Oct 2019 19:19:59 +0200
Subject: [PATCH] ao_alsa: handle underruns in get_space() too

This is essentially optional. But it will give the higher level code a
better guarantee that underruns were tested.
---
 audio/out/ao_alsa.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/audio/out/ao_alsa.c b/audio/out/ao_alsa.c
index 3185cb4c4b..275f5c08a0 100644
--- a/audio/out/ao_alsa.c
+++ b/audio/out/ao_alsa.c
@@ -970,6 +970,8 @@ static int get_space(struct ao *ao)
         check_device_present(ao, space);
         goto alsa_error;
     }
+    if (space == -EPIPE)
+        handle_underrun(ao);
 
     if (space > p->buffersize || space < 0) // Buffer underrun?
         space = p->buffersize;