From c7b73edc652785885163879bda3981a3d43cd466 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 7 Aug 2016 16:00:14 +0200 Subject: player: fix mid-stream audio sync condition This code is for resyncing audio-only streams (e.g. switching between audio tracks if no video track is active). This must not be run if the video PTS just isn't known yet. (Although the case in which this changes anything is probably very obscure, if it can even happen. Still, it's a bit more correct.) This is a correction to commit 91a3bda6. --- player/audio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'player/audio.c') diff --git a/player/audio.c b/player/audio.c index 8f74702473..fd007fedf7 100644 --- a/player/audio.c +++ b/player/audio.c @@ -670,10 +670,10 @@ static bool get_sync_samples(struct MPContext *mpctx, int *skip) sync_pts = mpctx->video_pts - opts->audio_delay; } else if (mpctx->hrseek_active) { sync_pts = mpctx->hrseek_pts; - } - // If the audio is enabled mid-stream during playback, sync accordingly. - if (sync_pts == MP_NOPTS_VALUE) + } else { + // If audio-only is enabled mid-stream during playback, sync accordingly. sync_pts = mpctx->playback_pts; + } if (sync_pts == MP_NOPTS_VALUE) { mpctx->audio_status = STATUS_FILLING; return true; // syncing disabled -- cgit v1.2.3