diff options
author | wm4 <wm4@nowhere> | 2014-07-13 20:06:33 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-07-13 20:06:33 +0200 |
commit | fb54a1436aced8462d63c1cdbb4972c05829e26f (patch) | |
tree | 686a62c43ea7833e286c1d6d4bf1630e018c897f /audio/out/pull.c | |
parent | b505cab59742dd47125153e63c690bf6ef591f61 (diff) | |
download | mpv-fb54a1436aced8462d63c1cdbb4972c05829e26f.tar.bz2 mpv-fb54a1436aced8462d63c1cdbb4972c05829e26f.tar.xz |
audio: don't wait for draining if paused
Logic for this was missing from pull.c. For push.c it was missing if the
driver didn't support it. But even if the driver supported it (such as
with ao_alsa), strange behavior was observed by users. See issue #933.
Always check explicitly whether the AO is in paused mode, and if so,
don't drain.
Possibly fixes #933.
CC: @mpv-player/stable
Diffstat (limited to 'audio/out/pull.c')
-rw-r--r-- | audio/out/pull.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/audio/out/pull.c b/audio/out/pull.c index 7902c9afb6..eb77be81a2 100644 --- a/audio/out/pull.c +++ b/audio/out/pull.c @@ -193,6 +193,14 @@ static void resume(struct ao *ao) ao->driver->resume(ao); } +static void drain(struct ao *ao) +{ + struct ao_pull_state *p = ao->api_priv; + if (atomic_load(&p->state) == AO_STATE_PLAY) + mp_sleep_us(get_delay(ao) * 1000000); + reset(ao); +} + static void uninit(struct ao *ao) { ao->driver->uninit(ao); @@ -212,6 +220,7 @@ const struct ao_driver ao_api_pull = { .init = init, .control = control, .uninit = uninit, + .drain = drain, .reset = reset, .get_space = get_space, .play = play, |