summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-11-27 10:19:28 +0100
committerwm4 <wm4@nowhere>2014-11-27 10:19:28 +0100
commit0ed77ca7e2445dd13a4ddfb9523774bbeecc7a81 (patch)
treebf0d71166cf4e0d1ed66c9ed581ee35f89406e9f /player
parenta98f88a12f70fd4950a69656235eea61d44b5105 (diff)
downloadmpv-0ed77ca7e2445dd13a4ddfb9523774bbeecc7a81.tar.bz2
mpv-0ed77ca7e2445dd13a4ddfb9523774bbeecc7a81.tar.xz
audio: fix busy loop when seeking while paused
When playing paused, the amount of decoded audio is limited to a small amount (1 sample), because we don't write any audio to the AO when paused. The small amount could trigger the case of the wanted audio being too far in the future in the PTS sync code, which set the audio status to STATUS_DRAINING, which in turn triggered the EOF code in the next iteration. This was ok, but unfortunately, this triggered another retry in order to check resuming from EOF by setting the status to STATUS_SYNCING, which in turn lead to the busy loop by alternating between the 2 states. So don't try resyncing while paused. Since the PTS syncing code also calls ao_reset(), this could cause the pulseaudio daemon to consume some CPU time as well. This was caused by commit 33b57f55. Before that, the playloop was merely run more often, but didn't cause any problems. Fixes #1288.
Diffstat (limited to 'player')
-rw-r--r--player/audio.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/player/audio.c b/player/audio.c
index f2b49b190c..a1e1182e8a 100644
--- a/player/audio.c
+++ b/player/audio.c
@@ -514,8 +514,10 @@ static void do_fill_audio_out_buffers(struct MPContext *mpctx, double endpts)
// restart audio properly. This helps with video files where audio starts
// later. Retrying is needed to get the correct sync PTS.
if (mpctx->audio_status >= STATUS_DRAINING && status == AD_OK) {
- mpctx->audio_status = STATUS_SYNCING;
- mpctx->sleeptime = 0;
+ if (!mpctx->paused) {
+ mpctx->audio_status = STATUS_SYNCING;
+ mpctx->sleeptime = 0;
+ }
return; // retry on next iteration
}