diff options
author | wm4 <wm4@nowhere> | 2014-11-06 01:17:36 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-11-06 01:17:36 +0100 |
commit | a54b99d1e5871d7962956a67411f17d9fdbe8680 (patch) | |
tree | 821de545a0ca466420d253eb5033c1e985ce1623 /audio/out/ao_oss.c | |
parent | 3d2e278029ac76734a067209555626a11a6f3ffc (diff) | |
download | mpv-a54b99d1e5871d7962956a67411f17d9fdbe8680.tar.bz2 mpv-a54b99d1e5871d7962956a67411f17d9fdbe8680.tar.xz |
ao_oss: wait for events with poll()
The intention is to avoid using the timeout-based fallback.
There's some minor hope that this will help with OpenBSD (see #1239),
although it probably won't.
Some chance that this will cause trouble with obscure OSS
implementations or emulations.
Diffstat (limited to 'audio/out/ao_oss.c')
-rw-r--r-- | audio/out/ao_oss.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/audio/out/ao_oss.c b/audio/out/ao_oss.c index 77ae374611..08266d96ce 100644 --- a/audio/out/ao_oss.c +++ b/audio/out/ao_oss.c @@ -616,6 +616,17 @@ static void audio_resume(struct ao *ao) ao_play_silence(ao, p->prepause_samples); } +static int audio_wait(struct ao *ao, pthread_mutex_t *lock) +{ + struct priv *p = ao->priv; + + struct pollfd fd = {.fd = p->audio_fd, .events = POLLOUT}; + int r = ao_wait_poll(ao, &fd, 1, lock); + if (fd.revents & (POLLERR | POLLNVAL)) + return -1; + return r; +} + #define OPT_BASE_STRUCT struct priv const struct ao_driver audio_out_oss = { @@ -631,6 +642,8 @@ const struct ao_driver audio_out_oss = { .resume = audio_resume, .reset = reset, .drain = drain, + .wait = audio_wait, + .wakeup = ao_wakeup_poll, .priv_size = sizeof(struct priv), .priv_defaults = &(const struct priv) { .audio_fd = -1, |