mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 10:41:04 +00:00
vaapidecode: flush output adapter at drain()
Calling drain() vmethod means "decode any data it can at this point, but that more data may arrive after". Hence, vaapidecode should check if there is data in the output adapter and process them, without destroying the decoded picture buffer (dpb). Since this operation is done by gst_vaapidecode_internal_flush(), the operation was refactored into a new function gst_vaapidecode_flush_output_adapter(). https://bugzilla.gnome.org/show_bug.cgi?id=768652
This commit is contained in:
parent
03e85bbc0f
commit
b392b4f064
1 changed files with 15 additions and 7 deletions
|
@ -682,6 +682,17 @@ not_negotiated:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If there is something in GstVideoDecoder's output adapter, then
|
||||||
|
submit the frame for decoding */
|
||||||
|
static inline void
|
||||||
|
gst_vaapidecode_flush_output_adapter (GstVaapiDecode * decode)
|
||||||
|
{
|
||||||
|
if (decode->current_frame_size == 0)
|
||||||
|
return;
|
||||||
|
gst_video_decoder_have_frame (GST_VIDEO_DECODER (decode));
|
||||||
|
decode->current_frame_size = 0;
|
||||||
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_vaapidecode_drain (GstVideoDecoder * vdec)
|
gst_vaapidecode_drain (GstVideoDecoder * vdec)
|
||||||
{
|
{
|
||||||
|
@ -690,6 +701,9 @@ gst_vaapidecode_drain (GstVideoDecoder * vdec)
|
||||||
if (!decode->decoder)
|
if (!decode->decoder)
|
||||||
return GST_FLOW_NOT_NEGOTIATED;
|
return GST_FLOW_NOT_NEGOTIATED;
|
||||||
|
|
||||||
|
GST_LOG_OBJECT (decode, "drain");
|
||||||
|
|
||||||
|
gst_vaapidecode_flush_output_adapter (decode);
|
||||||
return gst_vaapidecode_push_all_decoded_frames (decode);
|
return gst_vaapidecode_push_all_decoded_frames (decode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -702,13 +716,7 @@ gst_vaapidecode_internal_flush (GstVideoDecoder * vdec)
|
||||||
if (!decode->decoder)
|
if (!decode->decoder)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/* If there is something in GstVideoDecoder's output adapter, then
|
gst_vaapidecode_flush_output_adapter (decode);
|
||||||
submit the frame for decoding */
|
|
||||||
if (decode->current_frame_size) {
|
|
||||||
gst_video_decoder_have_frame (vdec);
|
|
||||||
decode->current_frame_size = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
status = gst_vaapi_decoder_flush (decode->decoder);
|
status = gst_vaapi_decoder_flush (decode->decoder);
|
||||||
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS) {
|
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS) {
|
||||||
GST_WARNING_OBJECT (decode, "failed to flush decoder (status %d)", status);
|
GST_WARNING_OBJECT (decode, "failed to flush decoder (status %d)", status);
|
||||||
|
|
Loading…
Reference in a new issue