streamsync: only remove DISCONT when needed
authorWim Taymans <wim.taymans@collabora.co.uk>
Thu, 6 Sep 2012 11:35:33 +0000 (13:35 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Thu, 6 Sep 2012 11:37:11 +0000 (13:37 +0200)
Check if the buffer is DISCONT before making a potentially expensive copy to
unset the DISCONT flag.

gst/playback/gststreamsynchronizer.c

index 7510f15..d28d540 100644 (file)
@@ -506,8 +506,11 @@ gst_stream_synchronizer_sink_chain (GstPad * pad, GstObject * parent,
   if (stream) {
     stream->seen_data = TRUE;
     if (stream->drop_discont) {
-      buffer = gst_buffer_make_writable (buffer);
-      GST_BUFFER_FLAG_UNSET (buffer, GST_BUFFER_FLAG_DISCONT);
+      if (GST_BUFFER_IS_DISCONT (buffer)) {
+        GST_DEBUG_OBJECT (pad, "removing DISCONT from buffer %p", buffer);
+        buffer = gst_buffer_make_writable (buffer);
+        GST_BUFFER_FLAG_UNSET (buffer, GST_BUFFER_FLAG_DISCONT);
+      }
       stream->drop_discont = FALSE;
     }