summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-08-06 17:41:44 +0200
committerwm4 <wm4@nowhere>2016-08-06 17:48:45 +0200
commit91a3bda6f52c0dd49b2cfba93186cc02e1d56bc5 (patch)
tree6e85e171240bb3b715aa4898d5ba03f44cad153b
parent7fd3dbcd526b22e6487b885d07498d7c80302c29 (diff)
downloadmpv-91a3bda6f52c0dd49b2cfba93186cc02e1d56bc5.tar.bz2
mpv-91a3bda6f52c0dd49b2cfba93186cc02e1d56bc5.tar.xz
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.
-rw-r--r--player/audio.c3
1 files changed, 3 insertions, 0 deletions
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