summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-06-04 12:42:13 +0200
committerwm4 <wm4@nowhere>2020-06-04 12:42:36 +0200
commitc67f36dd18f22dc027af129098a998866e4c2a33 (patch)
tree616102bc399ea02a21b22c17eee016a905d699f3
parent5f49009849271ecd995f9f41e4eb2a36a0fc024a (diff)
downloadmpv-c67f36dd18f22dc027af129098a998866e4c2a33.tar.bz2
mpv-c67f36dd18f22dc027af129098a998866e4c2a33.tar.xz
audio: fix deadlock on draining
The playback thread may obviously still fill the AO'S entire audio buffer, which means it unset p->draining, which makes no sense and broke ao_drain(). So just don't unset it here. Not sure if this really fixes this, it was hard to reproduce. Regression due to the recent changes. There are probably many more bugs like this. Stupid asynchronous nightmare state machine. Give me a language that supports formal verification (in presence of concurrency) or something.
-rw-r--r--audio/out/buffer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/audio/out/buffer.c b/audio/out/buffer.c
index c69ef6d813..dc053c3e2c 100644
--- a/audio/out/buffer.c
+++ b/audio/out/buffer.c
@@ -632,7 +632,7 @@ static void ao_play_data(struct ao *ao)
bool ok = true;
int written = 0;
if (samples) {
- p->draining = is_eof;
+ p->draining |= is_eof;
MP_STATS(ao, "start ao fill");
ok = ao->driver->write(ao, planes, samples);
MP_STATS(ao, "end ao fill");