vaXXXenc: calculate latency with corrected framerate

Fixes: #4558
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9437>
This commit is contained in:
Víctor Manuel Jáquez Leal 2025-07-24 18:16:51 +02:00 committed by GStreamer Marge Bot
parent 0d2157e801
commit 4a986e611b
6 changed files with 13 additions and 15 deletions

View File

@ -2867,8 +2867,8 @@ gst_va_av1_enc_reconfig (GstVaBaseEnc * base)
/* Set the latency */
latency = gst_util_uint64_scale (latency_num,
GST_VIDEO_INFO_FPS_D (&base->input_state->info) * GST_SECOND,
GST_VIDEO_INFO_FPS_N (&base->input_state->info));
GST_VIDEO_INFO_FPS_D (&base->in_info) * GST_SECOND,
GST_VIDEO_INFO_FPS_N (&base->in_info));
gst_video_encoder_set_latency (venc, latency, latency);
max_ref_frames = GST_AV1_NUM_REF_FRAMES;

View File

@ -1679,11 +1679,10 @@ gst_va_h264_enc_reconfig (GstVaBaseEnc * base)
/* Set the latency */
latency = gst_util_uint64_scale (latency_num,
GST_VIDEO_INFO_FPS_D (&base->input_state->info) * GST_SECOND,
GST_VIDEO_INFO_FPS_N (&base->input_state->info));
GST_VIDEO_INFO_FPS_D (&base->in_info) * GST_SECOND,
GST_VIDEO_INFO_FPS_N (&base->in_info));
gst_video_encoder_set_latency (venc, latency, latency);
max_ref_frames = self->gop.b_pyramid ?
self->gop.highest_pyramid_level + 2 : self->gop.num_ref_frames;
max_ref_frames += base->preferred_output_delay;

View File

@ -4650,8 +4650,8 @@ gst_va_h265_enc_reconfig (GstVaBaseEnc * base)
/* Set the latency */
latency = gst_util_uint64_scale (latency_num,
GST_VIDEO_INFO_FPS_D (&base->input_state->info) * GST_SECOND,
GST_VIDEO_INFO_FPS_N (&base->input_state->info));
GST_VIDEO_INFO_FPS_D (&base->in_info) * GST_SECOND,
GST_VIDEO_INFO_FPS_N (&base->in_info));
gst_video_encoder_set_latency (venc, latency, latency);
max_ref_frames = self->gop.b_pyramid ?

View File

@ -376,8 +376,7 @@ gst_va_jpeg_enc_reconfig (GstVaBaseEnc * base)
}
/* Unknown frame rate is allowed for jpeg, such as a single still image. */
if (GST_VIDEO_INFO_FPS_N (&base->in_info) == 0
|| GST_VIDEO_INFO_FPS_D (&base->in_info) == 0) {
if (GST_VIDEO_INFO_FPS_D (&base->in_info) == 0) {
GST_DEBUG_OBJECT (self, "Unknown framerate");
GST_VIDEO_INFO_FPS_N (&base->in_info) = 0;
GST_VIDEO_INFO_FPS_D (&base->in_info) = 1;
@ -393,8 +392,8 @@ gst_va_jpeg_enc_reconfig (GstVaBaseEnc * base)
/* Set the latency */
latency = gst_util_uint64_scale (latency_num,
GST_VIDEO_INFO_FPS_D (&base->input_state->info) * GST_SECOND,
GST_VIDEO_INFO_FPS_N (&base->input_state->info));
GST_VIDEO_INFO_FPS_D (&base->in_info) * GST_SECOND,
GST_VIDEO_INFO_FPS_N (&base->in_info));
gst_video_encoder_set_latency (venc, latency, latency);
}

View File

@ -655,8 +655,8 @@ gst_va_vp8_enc_reconfig (GstVaBaseEnc * base)
/* Set the latency */
latency = gst_util_uint64_scale (latency_num,
GST_VIDEO_INFO_FPS_D (&base->input_state->info) * GST_SECOND,
GST_VIDEO_INFO_FPS_N (&base->input_state->info));
GST_VIDEO_INFO_FPS_D (&base->in_info) * GST_SECOND,
GST_VIDEO_INFO_FPS_N (&base->in_info));
gst_video_encoder_set_latency (venc, latency, latency);
max_ref_frames = GST_VP8_MAX_REF_FRAMES;

View File

@ -2186,8 +2186,8 @@ gst_va_vp9_enc_reconfig (GstVaBaseEnc * base)
/* Set the latency */
latency = gst_util_uint64_scale (latency_num,
GST_VIDEO_INFO_FPS_D (&base->input_state->info) * GST_SECOND,
GST_VIDEO_INFO_FPS_N (&base->input_state->info));
GST_VIDEO_INFO_FPS_D (&base->in_info) * GST_SECOND,
GST_VIDEO_INFO_FPS_N (&base->in_info));
gst_video_encoder_set_latency (venc, latency, latency);
max_ref_frames = GST_VP9_REF_FRAMES;