summaryrefslogtreecommitdiffstats
path: root/mplayer.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2012-04-23 22:18:44 +0300
committerUoti Urpala <uau@mplayer2.org>2012-04-23 22:41:02 +0300
commitab6c760b3b58ec5b95b7d3af4fda941e8532dd70 (patch)
tree772c35002996ef271e45d38c103efbba08a03478 /mplayer.c
parentb255b5ad32fe49e4c01060ae01c67d246b5d6d38 (diff)
downloadmpv-ab6c760b3b58ec5b95b7d3af4fda941e8532dd70.tar.bz2
mpv-ab6c760b3b58ec5b95b7d3af4fda941e8532dd70.tar.xz
core: change initial sync with --delay, video stream switch
Make A/V sync at the start of playback with nonzero --delay behave the same way as it does when seeking to the beginning later, meaning video plays from the start and audio is truncated or padded with silence to match timing. This was already the default behavior in case the streams in the file started at different times, but not if the mismatch was due to --delay. Trigger similar audio synchronization when switching to a new video stream. Previously, switching a video stream on after playing for some time in audio-only mode was buggy and caused initial desync equal to the duration of prior audio-only playback.
Diffstat (limited to 'mplayer.c')
-rw-r--r--mplayer.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mplayer.c b/mplayer.c
index 0f63907df8..aecbce8275 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -2712,6 +2712,8 @@ int reinit_video_chain(struct MPContext *mpctx)
sh_video->last_pts = MP_NOPTS_VALUE;
sh_video->num_buffered_pts = 0;
sh_video->next_frame_time = 0;
+ mpctx->restart_playback = true;
+ mpctx->delay = 0;
if (opts->auto_quality > 0) {
// Auto quality option enabled
@@ -4837,7 +4839,6 @@ goto_enable_cache:
mixer_setvolume(&mpctx->mixer, start_volume, start_volume);
if (!ignore_start)
audio_delay -= mpctx->sh_audio->stream_delay;
- mpctx->delay = -audio_delay;
}
if (!mpctx->sh_audio) {