glcolorconvertelement: propagate failure to convert buffer upstream
authorMatthew Waters <matthew@centricular.com>
Fri, 17 Jul 2015 07:47:37 +0000 (17:47 +1000)
committerTim-Philipp Müller <tim@centricular.com>
Sat, 9 Dec 2017 19:32:05 +0000 (19:32 +0000)
Rather than just silently continuing

ext/gl/gstglcolorconvertelement.c

index 833d07e..8ad44ab 100644 (file)
@@ -197,13 +197,17 @@ gst_gl_color_convert_element_prepare_output_buffer (GstBaseTransform * bt,
     return GST_FLOW_NOT_NEGOTIATED;
 
   *outbuf = gst_gl_color_convert_perform (convert->convert, inbuf);
+  if (!*outbuf) {
+    GST_ELEMENT_ERROR (bt, RESOURCE, NOT_FOUND,
+        ("%s", "Failed to convert video buffer"), (NULL));
+    return GST_FLOW_ERROR;
+  }
 
   /* basetransform doesn't unref if they're the same */
   if (inbuf == *outbuf)
     gst_buffer_unref (*outbuf);
-  if (*outbuf)
-    gst_buffer_copy_into (*outbuf, inbuf,
-        GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS, 0, -1);
+  gst_buffer_copy_into (*outbuf, inbuf,
+      GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS, 0, -1);
 
   return GST_FLOW_OK;
 }