mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
vaapidecode: parse source data until a frame is obtained.
Parse any pending data until a complete frame is obtained. This is a memory optimization to avoid expansion of video packets stuffed into the GstAdapter, and a fix to EOS condition to detect there is actually pending data that needs to be decoded, and subsequently output. https://bugzilla.gnome.org/show_bug.cgi?id=731831
This commit is contained in:
parent
781abad2c7
commit
abfb5dd06c
1 changed files with 16 additions and 2 deletions
|
@ -54,6 +54,8 @@
|
|||
#define GST_PLUGIN_NAME "vaapidecode"
|
||||
#define GST_PLUGIN_DESC "A VA-API based video decoder"
|
||||
|
||||
#define GST_VAAPI_DECODE_FLOW_PARSE_DATA GST_FLOW_CUSTOM_SUCCESS_2
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC(gst_debug_vaapidecode);
|
||||
#define GST_CAT_DEFAULT gst_debug_vaapidecode
|
||||
|
||||
|
@ -785,7 +787,7 @@ gst_vaapidecode_set_format(GstVideoDecoder *vdec, GstVideoCodecState *state)
|
|||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_vaapidecode_parse(GstVideoDecoder *vdec,
|
||||
gst_vaapidecode_parse_frame(GstVideoDecoder *vdec,
|
||||
GstVideoCodecFrame *frame, GstAdapter *adapter, gboolean at_eos)
|
||||
{
|
||||
GstVaapiDecode * const decode = GST_VAAPIDECODE(vdec);
|
||||
|
@ -808,7 +810,7 @@ gst_vaapidecode_parse(GstVideoDecoder *vdec,
|
|||
decode->current_frame_size = 0;
|
||||
}
|
||||
else
|
||||
ret = GST_FLOW_OK;
|
||||
ret = GST_VAAPI_DECODE_FLOW_PARSE_DATA;
|
||||
break;
|
||||
case GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA:
|
||||
ret = GST_VIDEO_DECODER_FLOW_NEED_DATA;
|
||||
|
@ -829,6 +831,18 @@ gst_vaapidecode_parse(GstVideoDecoder *vdec,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_vaapidecode_parse(GstVideoDecoder *vdec,
|
||||
GstVideoCodecFrame *frame, GstAdapter *adapter, gboolean at_eos)
|
||||
{
|
||||
GstFlowReturn ret;
|
||||
|
||||
do {
|
||||
ret = gst_vaapidecode_parse_frame(vdec, frame, adapter, at_eos);
|
||||
} while (ret == GST_VAAPI_DECODE_FLOW_PARSE_DATA);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static GstStateChangeReturn
|
||||
gst_vaapidecode_change_state (GstElement * element, GstStateChange transition)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue