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/ao.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'audio/out/ao.c') diff --git a/audio/out/ao.c b/audio/out/ao.c index 977b8eb69a..8e1ceb4bf1 100644 --- a/audio/out/ao.c +++ b/audio/out/ao.c @@ -31,7 +31,6 @@ #include "options/options.h" #include "options/m_config.h" -#include "osdep/timer.h" #include "common/msg.h" #include "common/common.h" #include "common/global.h" @@ -313,22 +312,11 @@ void ao_resume(struct ao *ao) ao->api->resume(ao); } -// Be careful with locking -void ao_wait_drain(struct ao *ao) -{ - // This is probably not entirely accurate, but good enough. - mp_sleep_us(ao_get_delay(ao) * 1000000); - ao_reset(ao); -} - // Block until the current audio buffer has played completely. void ao_drain(struct ao *ao) { - if (ao->api->drain) { + if (ao->api->drain) ao->api->drain(ao); - } else { - ao_wait_drain(ao); - } } bool ao_eof_reached(struct ao *ao) -- cgit v1.2.3