summaryrefslogtreecommitdiffstats
path: root/player/audio.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-07-31 04:49:24 +0200
committerwm4 <wm4@nowhere>2014-07-31 04:49:44 +0200
commit0cce8fe64fda23e32a76e79965d6e0860cdbc7e2 (patch)
tree3a214b732a01f4a6678f4b7f14884131920bcfda /player/audio.c
parenta1b54d3b89ebc7a4a30c52c9c575003a98d89b4e (diff)
downloadmpv-0cce8fe64fda23e32a76e79965d6e0860cdbc7e2.tar.bz2
mpv-0cce8fe64fda23e32a76e79965d6e0860cdbc7e2.tar.xz
audio: fix A/V sync in encoding mode
In encoding mode, the AO pretends to be infinitely fast (it will take whatever we write, without ever rejecting input). Commit 261506e3 broke this somehow. It turns out an old hack dealing with this was accidentally dropped. This is the hunk of code whose semantics were (partially) dropped: if (mpctx->d_audio && (mpctx->restart_playback ? !video_left : ao_untimed(mpctx->ao) && (mpctx->delay <= 0 || !video_left))) { int status = fill_audio_out_buffers(mpctx, endpts); // Not at audio stream EOF yet audio_left = status > -2; } This if condition is pretty wild, and it looked like it was pretty much for audio-only mode, rather than subtle handling for encoding mode.
Diffstat (limited to 'player/audio.c')
-rw-r--r--player/audio.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/player/audio.c b/player/audio.c
index 849944cf91..f23f6db5cc 100644
--- a/player/audio.c
+++ b/player/audio.c
@@ -383,6 +383,11 @@ void fill_audio_out_buffers(struct MPContext *mpctx, double endpts)
return; // try again next iteration
}
+ // If audio is infinitely fast, somehow try keeping approximate A/V sync.
+ if (mpctx->audio_status == STATUS_PLAYING && ao_untimed(mpctx->ao) &&
+ !(mpctx->video_status == STATUS_EOF || mpctx->delay <= 0))
+ return;
+
// if paused, just initialize things (audio format & pts)
int playsize = 1;
if (!mpctx->paused)