vo: pass approximate frame duration in vo_frame

This information is already there, but speed adjusted. To avoid
duplicating the calculation of frame duration, it's kept in the
vo_frame structure.
This commit is contained in:
Kacper Michajłow 2023-11-14 09:07:45 +01:00 committed by Dudemanguy
parent d9e0ae737a
commit 88fc947552
2 changed files with 3 additions and 0 deletions

View File

@ -923,6 +923,7 @@ static void handle_display_sync_frame(struct MPContext *mpctx,
frame->ideal_frame_vsync_duration = (vsync / frame_duration) * approx_duration;
frame->num_vsyncs = num_vsyncs;
frame->display_synced = true;
frame->approx_duration = approx_duration;
// Adjust frame virtual vsyncs by the repeat count
if (drop_repeat > 0)

View File

@ -251,6 +251,8 @@ struct vo_frame {
// VO if frames are dropped.
int num_frames;
struct mp_image *frames[VO_MAX_REQ_FRAMES];
// Speed unadjusted, approximate frame duration inferred from past frames
double approx_duration;
// ID for frames[0] (== current). If current==NULL, the number is
// meaningless. Otherwise, it's an unique ID for the frame. The ID for
// a frame is guaranteed not to change (instant redraws will use the same