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)
committerMatthew Waters <matthew@centricular.com>
Fri, 13 Mar 2015 12:30:20 +0000 (12:30 +0000)
basetransform doesn't unref equal input and output buffers

ext/gl/gstgluploadelement.c

index 56a0f53a25a5144f892bfb8e5fa3279c93567449..1a692143dc5b878c4182cb3aefbc8e9a6a16a846 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;
 }