mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 15:27:07 +00:00
vabaseenc: Set the correct min_buffers for propose_allocation()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4359>
This commit is contained in:
parent
941d0c417f
commit
7a03813ee9
6 changed files with 17 additions and 6 deletions
|
@ -2864,8 +2864,10 @@ gst_va_av1_enc_reconfig (GstVaBaseEnc * base)
|
|||
GST_VIDEO_INFO_FPS_N (&base->input_state->info));
|
||||
gst_video_encoder_set_latency (venc, latency, latency);
|
||||
|
||||
max_ref_frames = GST_AV1_NUM_REF_FRAMES + 3 /* scratch frames */ ;
|
||||
max_ref_frames = GST_AV1_NUM_REF_FRAMES;
|
||||
max_ref_frames += base->preferred_output_delay;
|
||||
base->min_buffers = max_ref_frames;
|
||||
max_ref_frames += 3 /* scratch frames */ ;
|
||||
|
||||
/* second check after calculations */
|
||||
do_reopen |=
|
||||
|
|
|
@ -76,6 +76,7 @@ gst_va_base_enc_reset_state_default (GstVaBaseEnc * base)
|
|||
base->rt_format = 0;
|
||||
base->codedbuf_size = 0;
|
||||
base->preferred_output_delay = 0;
|
||||
base->min_buffers = 1;
|
||||
g_atomic_int_set (&base->reconf, FALSE);
|
||||
}
|
||||
|
||||
|
@ -417,7 +418,7 @@ gst_va_base_enc_propose_allocation (GstVideoEncoder * venc, GstQuery * query)
|
|||
if (!(allocator = _allocator_from_caps (base, caps)))
|
||||
return FALSE;
|
||||
|
||||
pool = gst_va_pool_new_with_config (caps, 1, 0, usage_hint,
|
||||
pool = gst_va_pool_new_with_config (caps, base->min_buffers, 0, usage_hint,
|
||||
GST_VA_FEATURE_AUTO, allocator, ¶ms);
|
||||
if (!pool) {
|
||||
gst_object_unref (allocator);
|
||||
|
@ -428,7 +429,7 @@ gst_va_base_enc_propose_allocation (GstVideoEncoder * venc, GstQuery * query)
|
|||
goto config_failed;
|
||||
|
||||
gst_query_add_allocation_param (query, allocator, ¶ms);
|
||||
gst_query_add_allocation_pool (query, pool, size, 1, 0);
|
||||
gst_query_add_allocation_pool (query, pool, size, base->min_buffers, 0);
|
||||
|
||||
GST_DEBUG_OBJECT (base,
|
||||
"proposing %" GST_PTR_FORMAT " with allocator %" GST_PTR_FORMAT,
|
||||
|
@ -958,6 +959,7 @@ gst_va_base_enc_init (GstVaBaseEnc * self)
|
|||
g_queue_init (&self->ref_list);
|
||||
g_queue_init (&self->output_list);
|
||||
gst_video_info_init (&self->in_info);
|
||||
self->min_buffers = 1;
|
||||
|
||||
self->dts_queue = gst_vec_deque_new_for_struct (sizeof (GstClockTime), 8);
|
||||
|
||||
|
|
|
@ -61,6 +61,8 @@ struct _GstVaBaseEnc
|
|||
gint height;
|
||||
guint rt_format;
|
||||
guint codedbuf_size;
|
||||
/* The min buffer number required for reorder and output delay. */
|
||||
guint min_buffers;
|
||||
|
||||
GstClockTime start_pts;
|
||||
GstClockTime frame_duration;
|
||||
|
|
|
@ -1658,8 +1658,10 @@ gst_va_h264_enc_reconfig (GstVaBaseEnc * base)
|
|||
GST_VIDEO_INFO_FPS_N (&base->input_state->info));
|
||||
gst_video_encoder_set_latency (venc, latency, latency);
|
||||
|
||||
max_ref_frames = self->gop.num_ref_frames + 3 /* scratch frames */ ;
|
||||
max_ref_frames = self->gop.num_ref_frames;
|
||||
max_ref_frames += base->preferred_output_delay;
|
||||
base->min_buffers = max_ref_frames;
|
||||
max_ref_frames += 3 /* scratch frames */ ;
|
||||
|
||||
/* second check after calculations */
|
||||
do_reopen |=
|
||||
|
|
|
@ -4649,8 +4649,9 @@ gst_va_h265_enc_reconfig (GstVaBaseEnc * base)
|
|||
|
||||
max_ref_frames = self->gop.b_pyramid ?
|
||||
self->gop.highest_pyramid_level + 2 : self->gop.num_ref_frames;
|
||||
max_ref_frames += 3 /* scratch frames */ ;
|
||||
max_ref_frames += base->preferred_output_delay;
|
||||
base->min_buffers = max_ref_frames;
|
||||
max_ref_frames += 3 /* scratch frames */ ;
|
||||
|
||||
/* second check after calculations */
|
||||
do_reopen |=
|
||||
|
|
|
@ -2189,8 +2189,10 @@ gst_va_vp9_enc_reconfig (GstVaBaseEnc * base)
|
|||
GST_VIDEO_INFO_FPS_N (&base->input_state->info));
|
||||
gst_video_encoder_set_latency (venc, latency, latency);
|
||||
|
||||
max_ref_frames = GST_VP9_REF_FRAMES + 3 /* scratch frames */ ;
|
||||
max_ref_frames = GST_VP9_REF_FRAMES;
|
||||
max_ref_frames += base->preferred_output_delay;
|
||||
base->min_buffers = max_ref_frames;
|
||||
max_ref_frames += 3 /* scratch frames */ ;
|
||||
|
||||
/* second check after calculations */
|
||||
do_reopen |=
|
||||
|
|
Loading…
Reference in a new issue