1
mirror of https://github.com/mpv-player/mpv synced 2024-10-26 07:22:17 +02:00

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.
This commit is contained in:
wm4 2016-08-07 16:00:14 +02:00
parent 32cc190a55
commit c7b73edc65

View File

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