aboutsummaryrefslogtreecommitdiffhomepage
path: root/player/audio.c
diff options
context:
space:
mode:
authorGravatar wm4 <wm4@nowhere>2016-08-07 16:00:14 +0200
committerGravatar wm4 <wm4@nowhere>2016-08-07 16:00:14 +0200
commitc7b73edc652785885163879bda3981a3d43cd466 (patch)
tree311e4c4e736b2855c87fbe97c80764c1f8ce8e5a /player/audio.c
parent32cc190a552551cc7e7150e8603b6a75e0a6d94f (diff)
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.
Diffstat (limited to 'player/audio.c')
-rw-r--r--player/audio.c6
1 files changed, 3 insertions, 3 deletions
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