mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 17:50:36 +00:00
vaapidecode: refactor gst_vaapidecode_internal_flush()
This a cosmetic refactor: gst_vaapidecode_internal_flush() removes its only label; gst_vaapidecode_finish() is more readable and gst_vaapidecode_purge() shares the same error message of gst_vaapidecode_internal_flush() when flush fails.
This commit is contained in:
parent
dbc8f3f25f
commit
99f95690b5
1 changed files with 11 additions and 14 deletions
|
@ -471,32 +471,29 @@ gst_vaapidecode_internal_flush (GstVideoDecoder * vdec)
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
||||||
goto error_flush;
|
GST_WARNING_OBJECT (decode, "failed to flush decoder (status %d)", status);
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
/* ERRORS */
|
|
||||||
error_flush:
|
|
||||||
{
|
|
||||||
GST_ERROR ("failed to flush decoder (status %d)", status);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_vaapidecode_finish (GstVideoDecoder * vdec)
|
gst_vaapidecode_finish (GstVideoDecoder * vdec)
|
||||||
{
|
{
|
||||||
GstVaapiDecode *const decode = GST_VAAPIDECODE (vdec);
|
GstVaapiDecode *const decode = GST_VAAPIDECODE (vdec);
|
||||||
|
gboolean flushed;
|
||||||
|
GstFlowReturn ret;
|
||||||
|
|
||||||
if (!decode->decoder)
|
if (!decode->decoder)
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
|
|
||||||
if (!gst_vaapidecode_internal_flush (vdec)) {
|
flushed = gst_vaapidecode_internal_flush (vdec);
|
||||||
gst_vaapidecode_push_all_decoded_frames (decode);
|
ret = gst_vaapidecode_push_all_decoded_frames (decode);
|
||||||
|
if (!flushed)
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
}
|
return ret;
|
||||||
|
|
||||||
return gst_vaapidecode_push_all_decoded_frames (decode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -640,7 +637,7 @@ gst_vaapidecode_purge (GstVaapiDecode * decode)
|
||||||
|
|
||||||
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_INFO_OBJECT (decode, "decoder flush failed");
|
GST_INFO_OBJECT (decode, "failed to flush decoder (status %d)", status);
|
||||||
|
|
||||||
/* Purge all decoded frames as we don't need them (e.g. flush and close)
|
/* Purge all decoded frames as we don't need them (e.g. flush and close)
|
||||||
* Releasing the frames is important, otherwise the frames are not
|
* Releasing the frames is important, otherwise the frames are not
|
||||||
|
|
Loading…
Reference in a new issue