gst/playback/gststreamselector.c: 3rd time's the charm. Correct ref-counting for...
authorJan Schmidt <thaytan@mad.scientist.com>
Tue, 29 Nov 2005 16:54:50 +0000 (16:54 +0000)
committerJan Schmidt <thaytan@mad.scientist.com>
Tue, 29 Nov 2005 16:54:50 +0000 (16:54 +0000)
Original commit message from CVS:
* gst/playback/gststreamselector.c: (gst_stream_selector_chain):
3rd time's the charm. Correct ref-counting for discarded buffers.

ChangeLog
gst/playback/gststreamselector.c

index fa91e89..92c3bbe 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2005-11-29  Jan Schmidt  <thaytan@mad.scientist.com>
 
+       * gst/playback/gststreamselector.c: (gst_stream_selector_chain):
+       3rd time's the charm. Correct ref-counting for discarded buffers.
+
+2005-11-29  Jan Schmidt  <thaytan@mad.scientist.com>
+
        * gst/playback/gststreamselector.c:
        (gst_stream_selector_class_init),
        (gst_stream_selector_set_property),
index 8785feb..57b0660 100644 (file)
@@ -326,12 +326,19 @@ gst_stream_selector_chain (GstPad * pad, GstBuffer * buf)
 {
   GstStreamSelector *sel = GST_STREAM_SELECTOR (gst_pad_get_parent (pad));
   GstFlowReturn res;
+  GstPad *active_sinkpad;
+
+  GST_OBJECT_LOCK (sel);
+  active_sinkpad = sel->active_sinkpad;
+  GST_OBJECT_UNLOCK (sel);
 
   /* Ignore buffers from pads except the selected one */
-  if (pad != sel->active_sinkpad) {
+  if (pad != active_sinkpad) {
     GST_DEBUG_OBJECT (sel, "Ignoring buffer %p from pad %s:%s",
         buf, GST_DEBUG_PAD_NAME (pad));
+
     gst_object_unref (sel);
+    gst_buffer_unref (buf);
     return GST_FLOW_NOT_LINKED;
   }