aboutsummaryrefslogtreecommitdiffstats
path: root/src/audio.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-26 07:12:29 +0200
committerMax Kellermann <max@duempel.org>2008-09-26 07:12:29 +0200
commite2a12deead431f86c24d71579c954e00e73ed447 (patch)
treeef10aa00cbf8da29f2c0086e9ea6540c801af726 /src/audio.c
parent05f66e04a413114103ca3a14f742b0430f6858e0 (diff)
downloadmpd-e2a12deead431f86c24d71579c954e00e73ed447.tar.gz
mpd-e2a12deead431f86c24d71579c954e00e73ed447.tar.xz
mpd-e2a12deead431f86c24d71579c954e00e73ed447.zip
audio_output: workaround for deadlock
During debugging, I found a deadlock between flushAudioBuffer() and the audio_output_task(): audio_output_task() didn't notice that there is a command, and flushAudioBuffer() waited forever in notify_wait(). I am not sure yet what is the real cause; work around this for now by waking up non-finished audio outputs in every iteration.
Diffstat (limited to 'src/audio.c')
-rw-r--r--src/audio.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/audio.c b/src/audio.c
index 443f5d82d..d3e3ac908 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -281,7 +281,7 @@ static int flushAudioBuffer(void)
int finished = 1;
for (i = 0; i < audioOutputArraySize; ++i) {
- const struct audio_output *ao = &audioOutputArray[i];
+ struct audio_output *ao = &audioOutputArray[i];
if (!audio_output_is_open(ao))
continue;
@@ -295,8 +295,10 @@ static int flushAudioBuffer(void)
closed if the play func
returned an error */
audioDeviceStates[i] = DEVICE_ENABLE;
- } else
+ } else {
finished = 0;
+ audio_output_signal(ao);
+ }
}
if (finished)