mirror of
https://github.com/mpv-player/mpv
synced 2025-03-07 22:57:42 +00:00
audio/out/push: when using audio wait fallback, recheck condition
If calling ao->driver->wait() fails, we need to fallback to timeout- based waiting. But it could be that at this point, the mutex was already released (and then re-acquired). So we need to recheck the condition in order to avoid missed wakeups. This probably wasn't an actually occurring problem, but still could cause a small race-condition window if the dynamic fallback is actually used.
This commit is contained in:
parent
e36f4b6bc1
commit
3d2e278029
@ -352,7 +352,8 @@ static void *playthread(void *arg)
|
||||
if (ao->driver->get_delay)
|
||||
timeout = ao->driver->get_delay(ao);
|
||||
timeout *= 0.25; // wake up if 25% played
|
||||
mpthread_cond_timedwait_rel(&p->wakeup, &p->lock, timeout);
|
||||
if (!p->need_wakeup)
|
||||
mpthread_cond_timedwait_rel(&p->wakeup, &p->lock, timeout);
|
||||
}
|
||||
}
|
||||
MP_STATS(ao, "end audio wait");
|
||||
|
Loading…
Reference in New Issue
Block a user