summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-11-27 10:19:28 +0100
committerAlessandro Ghedini <alessandro@ghedini.me>2014-11-28 15:50:58 +0100
commit4f74869cd86f711f19a7537f5e599ec8aeccc9c2 (patch)
tree603fed2de453e0653076b88f32f97a610e8a03fe
parent8d8b36df1b7c14b5fd2c10b02d1431cd64f0f1a1 (diff)
downloadmpv-4f74869cd86f711f19a7537f5e599ec8aeccc9c2.tar.bz2
mpv-4f74869cd86f711f19a7537f5e599ec8aeccc9c2.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.
-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
}