diff options
author | wm4 <wm4@nowhere> | 2015-05-11 23:44:36 +0200 |
---|---|---|
committer | Diogo Franco (Kovensky) <diogomfranco@gmail.com> | 2015-05-15 10:30:15 +0900 |
commit | 37ad3e79dd03cecc4be3a7341fdf69f96873d2eb (patch) | |
tree | ae9e6ec463c69918c334c637901427a94013c017 /audio | |
parent | 328d0c7fc326abce5fc1783e74cdd082c87d4986 (diff) | |
download | mpv-37ad3e79dd03cecc4be3a7341fdf69f96873d2eb.tar.bz2 mpv-37ad3e79dd03cecc4be3a7341fdf69f96873d2eb.tar.xz |
threads: use utility+POSIX functions instead of weird wrappers
There is not much of a reason to have these wrappers around. Use POSIX
standard functions directly, and use a separate utility function to take
care of the timespec calculations. (Course POSIX for using this weird
format for time values.)
(cherry picked from commit 92b9d75d7256be71d8c8b18438af9494b78f0e96)
Diffstat (limited to 'audio')
-rw-r--r-- | audio/out/push.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/audio/out/push.c b/audio/out/push.c index 8e3d2f87b0..beafd36a13 100644 --- a/audio/out/push.c +++ b/audio/out/push.c @@ -340,7 +340,8 @@ static void *playthread(void *arg) pthread_cond_signal(&p->wakeup); // for draining if (p->still_playing && timeout > 0) { - mpthread_cond_timedwait_rel(&p->wakeup, &p->lock, timeout); + struct timespec ts = mp_rel_time_to_timespec(timeout); + pthread_cond_timedwait(&p->wakeup, &p->lock, &ts); } else { pthread_cond_wait(&p->wakeup, &p->lock); } @@ -352,8 +353,10 @@ static void *playthread(void *arg) if (ao->driver->get_delay) timeout = ao->driver->get_delay(ao); timeout *= 0.25; // wake up if 25% played - if (!p->need_wakeup) - mpthread_cond_timedwait_rel(&p->wakeup, &p->lock, timeout); + if (!p->need_wakeup) { + struct timespec ts = mp_rel_time_to_timespec(timeout); + pthread_cond_timedwait(&p->wakeup, &p->lock, &ts); + } } } MP_STATS(ao, "end audio wait"); |