1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-27 17:42:17 +00:00

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.
This commit is contained in:
wm4 2016-08-06 17:41:44 +02:00
parent 7fd3dbcd52
commit 91a3bda6f5

View File

@ -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