vaapidecode: remove gst_vaapidecode_internal_flush()
authorVíctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Sun, 10 Jul 2016 17:01:17 +0000 (19:01 +0200)
committerVíctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Mon, 11 Jul 2016 08:40:14 +0000 (10:40 +0200)
As gst_vaapidecode_finish() is the only callee of
gst_vaapidecode_internal_flush(), it is better to inline it.

https://bugzilla.gnome.org/show_bug.cgi?id=768652

gst/vaapi/gstvaapidecode.c

index a5ad731..83dff65 100644 (file)
@@ -707,40 +707,29 @@ gst_vaapidecode_drain (GstVideoDecoder * vdec)
   return gst_vaapidecode_push_all_decoded_frames (decode);
 }
 
-static gboolean
-gst_vaapidecode_internal_flush (GstVideoDecoder * vdec)
-{
-  GstVaapiDecode *const decode = GST_VAAPIDECODE (vdec);
-  GstVaapiDecoderStatus status;
-
-  if (!decode->decoder)
-    return TRUE;
-
-  gst_vaapidecode_flush_output_adapter (decode);
-  status = gst_vaapi_decoder_flush (decode->decoder);
-  if (status != GST_VAAPI_DECODER_STATUS_SUCCESS) {
-    GST_WARNING_OBJECT (decode, "failed to flush decoder (status %d)", status);
-    return FALSE;
-  }
-
-  return TRUE;
-}
-
 static GstFlowReturn
 gst_vaapidecode_finish (GstVideoDecoder * vdec)
 {
   GstVaapiDecode *const decode = GST_VAAPIDECODE (vdec);
-  gboolean flushed;
+  GstVaapiDecoderStatus status;
   GstFlowReturn ret;
 
   if (!decode->decoder)
     return GST_FLOW_OK;
 
-  flushed = gst_vaapidecode_internal_flush (vdec);
+  gst_vaapidecode_flush_output_adapter (decode);
+  status = gst_vaapi_decoder_flush (decode->decoder);
   ret = gst_vaapidecode_push_all_decoded_frames (decode);
-  if (!flushed)
-    return GST_FLOW_ERROR;
+  if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
+    goto error_decoder_flush;
   return ret;
+
+  /* ERRORS: */
+error_decoder_flush:
+  {
+    GST_WARNING_OBJECT (decode, "failed to flush decoder (status %d)", status);
+    return GST_FLOW_ERROR;
+  }
 }
 
 static gboolean