summaryrefslogtreecommitdiffstats
path: root/audio/out/push.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-05-11 23:44:36 +0200
committerwm4 <wm4@nowhere>2015-05-11 23:44:36 +0200
commit92b9d75d7256be71d8c8b18438af9494b78f0e96 (patch)
treeeaf114423ce898dc5ac77f5fa48c3f13ef699c41 /audio/out/push.c
parentca9964a4fb6b1faa0155da43b3c815db0075e2d5 (diff)
downloadmpv-92b9d75d7256be71d8c8b18438af9494b78f0e96.tar.bz2
mpv-92b9d75d7256be71d8c8b18438af9494b78f0e96.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.)
Diffstat (limited to 'audio/out/push.c')
-rw-r--r--audio/out/push.c9
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");