From 91a3bda6f52c0dd49b2cfba93186cc02e1d56bc5 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 6 Aug 2016 17:41:44 +0200 Subject: player: sync audio as well when enabling it mid-stream If an audio track is enabled during playback, then make it resume at the exact "current position", instead of playing audio before that position. This was already done for video. --- player/audio.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'player') diff --git a/player/audio.c b/player/audio.c index 2f2bc07f0f..8f74702473 100644 --- a/player/audio.c +++ b/player/audio.c @@ -671,6 +671,9 @@ static bool get_sync_samples(struct MPContext *mpctx, int *skip) } 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) + sync_pts = mpctx->playback_pts; if (sync_pts == MP_NOPTS_VALUE) { mpctx->audio_status = STATUS_FILLING; return true; // syncing disabled -- cgit v1.2.3