From fb54a1436aced8462d63c1cdbb4972c05829e26f Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 13 Jul 2014 20:06:33 +0200 Subject: 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 --- audio/out/pull.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'audio/out/pull.c') 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, -- cgit v1.2.3