From afdd2fa5656140c55a0b685e498a89a2249a623a Mon Sep 17 00:00:00 2001 From: llyyr Date: Sat, 26 Aug 2023 03:15:14 +0530 Subject: [PATCH] player: use audio pts corresponding to playing audio on EOF We should account for ao queue when setting playback position on EOF, previously we were using the pts value corresponding to the start of the ao queue, rather than the currently playing audio. This fixes time-remaining being a negative number when mpv seeks to EOF while playback is paused. --- player/playloop.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/player/playloop.c b/player/playloop.c index 02902f17cd..dc74e6b849 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -1085,8 +1085,7 @@ static void handle_playback_time(struct MPContext *mpctx) } else if (mpctx->video_status == STATUS_EOF && mpctx->audio_status == STATUS_EOF) { - double apts = - mpctx->ao_chain ? mpctx->ao_chain->last_out_pts : MP_NOPTS_VALUE; + double apts = playing_audio_pts(mpctx); double vpts = mpctx->video_pts; double mpts = MP_PTS_MAX(apts, vpts); if (mpts != MP_NOPTS_VALUE)