diff options
author | wm4 <wm4@nowhere> | 2014-11-06 01:15:44 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-11-06 01:15:44 +0100 |
commit | 3d2e278029ac76734a067209555626a11a6f3ffc (patch) | |
tree | c4a8b95201ca6c1f007dabc1c6ebbae2745a3529 /audio/out/push.c | |
parent | e36f4b6bc1569205769ca6a541de9aebf0d12625 (diff) | |
download | mpv-3d2e278029ac76734a067209555626a11a6f3ffc.tar.bz2 mpv-3d2e278029ac76734a067209555626a11a6f3ffc.tar.xz |
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.
Diffstat (limited to 'audio/out/push.c')
-rw-r--r-- | audio/out/push.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/audio/out/push.c b/audio/out/push.c index 187d5ef03a..5872b01913 100644 --- a/audio/out/push.c +++ b/audio/out/push.c @@ -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"); |