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.
This commit is contained in:
wm4 2020-06-04 12:42:13 +02:00
parent 5f49009849
commit c67f36dd18
1 changed files with 1 additions and 1 deletions

View File

@ -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");