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.
This commit is contained in:
Haihao Xiang 2019-05-08 16:05:07 +08:00 committed by Víctor Manuel Jáquez Leal
parent 8bad9d5d8a
commit 1221898404
2 changed files with 5 additions and 0 deletions

View file

@ -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;

View file

@ -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;