gluploadelement: properly unref buffers that are the same as the input
authorMatthew Waters <matthew@centricular.com>
Fri, 13 Mar 2015 12:28:36 +0000 (12:28 +0000)
committerTim-Philipp Müller <tim@centricular.com>
Sat, 9 Dec 2017 19:31:57 +0000 (19:31 +0000)
basetransform doesn't unref equal input and output buffers

ext/gl/gstgluploadelement.c

index 56a0f53..1a69214 100644 (file)
@@ -211,6 +211,7 @@ gst_gl_upload_element_query (GstBaseTransform * bt, GstPadDirection direction,
     case GST_QUERY_DRAIN:
       if (upload->upload)
         gst_gl_upload_release_buffer (upload->upload);
+      break;
     default:
       break;
   }
@@ -239,6 +240,10 @@ gst_gl_upload_element_prepare_output_buffer (GstBaseTransform * bt,
     gst_buffer_copy_into (*outbuf, buffer,
         GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS, 0, -1);
 
+  /* basetransform doesn't unref if they're the same */
+  if (buffer == *outbuf)
+    gst_buffer_unref (*outbuf);
+
   return ret == GST_GL_UPLOAD_DONE ? GST_FLOW_OK : GST_FLOW_ERROR;
 }