diff options
author | Dudemanguy <random342@airmail.cc> | 2024-03-02 09:50:23 -0600 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2024-03-03 16:24:28 -0600 |
commit | d10cebec1317d1fd9006f3bd3bdc6d75e399ebaa (patch) | |
tree | 0d00d47147dca8d3ddc37e87383c5fb10b81c5e8 /player/video.c | |
parent | 60abbb424bef6873e7bfcbae0f43c4b972fe4274 (diff) | |
download | mpv-d10cebec1317d1fd9006f3bd3bdc6d75e399ebaa.tar.bz2 mpv-d10cebec1317d1fd9006f3bd3bdc6d75e399ebaa.tar.xz |
player/video: subtract frame_time from delay when ao_chain starts audio
This seems more robust than relying on the audio status to actually be
playing. For files where there is no audio or the audio start is
delayed, this guards against that but it allows the subtraction to
always occur otherwise on normal files with audio.
Diffstat (limited to 'player/video.c')
-rw-r--r-- | player/video.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/player/video.c b/player/video.c index 6b63cc7b0e..c33f947659 100644 --- a/player/video.c +++ b/player/video.c @@ -359,7 +359,6 @@ static void adjust_sync(struct MPContext *mpctx, double v_pts, double frame_time if (mpctx->audio_status != STATUS_PLAYING) return; - mpctx->delay -= frame_time; double a_pts = written_audio_pts(mpctx) + opts->audio_delay - mpctx->delay; double av_delay = a_pts - v_pts; @@ -401,6 +400,8 @@ static void handle_new_frame(struct MPContext *mpctx) } } mpctx->time_frame += frame_time / mpctx->video_speed; + if (mpctx->ao_chain && mpctx->ao_chain->audio_started) + mpctx->delay -= frame_time; if (mpctx->video_status >= STATUS_PLAYING) adjust_sync(mpctx, pts, frame_time); MP_TRACE(mpctx, "frametime=%5.3f\n", frame_time); |