summaryrefslogtreecommitdiffstats
path: root/player/video.c
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-11-10 22:37:52 +0100
committerDudemanguy <random342@airmail.cc>2023-11-11 20:44:01 +0000
commit5e5a32534ad9aa340f7cf76b2d54461e8f7d1098 (patch)
treeeaf98373dc65ad912a9d3272bcf8407cb4672e0a /player/video.c
parent332619042f00689b9609a35a16756beadd617fcf (diff)
downloadmpv-5e5a32534ad9aa340f7cf76b2d54461e8f7d1098.tar.bz2
mpv-5e5a32534ad9aa340f7cf76b2d54461e8f7d1098.tar.xz
vo: add frame vsync and vsync duration
Relative to frame PTS timeline as oposed to display vblank. Those values are relative to unadjusted video timeline. They will be used by gpu-next where it expect virtual frame vsync, not display vblank time.
Diffstat (limited to 'player/video.c')
-rw-r--r--player/video.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/player/video.c b/player/video.c
index 6d16f675ef..879cd52497 100644
--- a/player/video.c
+++ b/player/video.c
@@ -834,8 +834,8 @@ static void handle_display_sync_frame(struct MPContext *mpctx,
if (vsync <= 0)
return;
- double adjusted_duration = MPMAX(0, mpctx->past_frames[0].approx_duration);
- adjusted_duration /= opts->playback_speed;
+ double approx_duration = MPMAX(0, mpctx->past_frames[0].approx_duration);
+ double adjusted_duration = approx_duration / opts->playback_speed;
if (adjusted_duration > 0.5)
return;
@@ -919,6 +919,8 @@ static void handle_display_sync_frame(struct MPContext *mpctx,
frame->vsync_interval = vsync;
frame->vsync_offset = -prev_error;
frame->ideal_frame_duration = frame_duration;
+ frame->ideal_frame_vsync = (-prev_error / frame_duration) * approx_duration;
+ frame->ideal_frame_vsync_duration = approx_duration / num_vsyncs;
frame->num_vsyncs = num_vsyncs;
frame->display_synced = true;