Commit 12218984 authored by Haihao Xiang's avatar Haihao Xiang Committed by Víctor Manuel Jáquez Leal

msdkenc: allow encode element requires extra frames

The call of MFXVideoENCODE_EncodeFrameAsync may not generate output and
the function returns MFX_ERR_MORE_DATA with NULL sync point, the input
frame is cached in this case, so it is possible that all allocated
frames go into the surfaces_used list after calling
MFXVideoENCODE_EncodeFrameAsync a few times, then the encoder will fail
to get an available surface before releasing used frames

This patch adds a new field of num_extra_frames to GstMsdkEnc and allows
encode element requires extra frames, the default value is 0.

This patch is the preparation for msdkvp9enc element.
parent 8bad9d5d
......@@ -454,6 +454,8 @@ gst_msdkenc_init_encoder (GstMsdkEnc * thiz)
msdk_status_to_string (status));
}
request[0].NumFrameSuggested += thiz->num_extra_frames;
if (thiz->has_vpp)
request[0].NumFrameSuggested += thiz->num_vpp_surfaces + 1 - 4;
......
......@@ -104,6 +104,9 @@ struct _GstMsdkEnc
guint num_tasks;
MsdkEncTask *tasks;
guint next_task;
/* Extra frames for encoding, set by each element,
* the default value is 0 */
guint num_extra_frames;
gboolean has_vpp;
mfxVideoParam vpp_param;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment