From 66fb1d1cdb7734be399981c99a0ee4e985f10f0f Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Thu, 26 Oct 2023 22:59:09 -0500 Subject: [PATCH] player/audio: fix incorrect check on adding delay dac977193cccbf7e2e999cf0c4b0292314839c4c changed adding delay to only when the video is playing but this isn't correct. The video frames adjust themselves based on the audio, so if we still have audio processing while the video itself happens to be in some non-playing state (such as STATUS_READY), the delay still needs to be taken into account. The correct thing to check is to make sure that it is not STATUS_EOF. STATUS_EOF covers the case where we have still image, and of course no video at all is STATUS_EOF. So having a massive bogus delay value is still avoided. --- player/audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/player/audio.c b/player/audio.c index ba3cc90e7b..ca17d3325b 100644 --- a/player/audio.c +++ b/player/audio.c @@ -723,7 +723,7 @@ static void ao_process(struct mp_filter *f) mpctx->shown_aframes += samples; double real_samplerate = mp_aframe_get_rate(af) / mpctx->audio_speed; - if (mpctx->video_status == STATUS_PLAYING) + if (mpctx->video_status != STATUS_EOF) mpctx->delay += samples / real_samplerate; ao_c->last_out_pts = mp_aframe_end_pts(af); update_throttle(mpctx);