inputselector: Keep previous active sinkpad around until we're done with it
authorSebastian Dröge <slomo@circular-chaos.org>
Wed, 10 Jul 2013 12:30:31 +0000 (14:30 +0200)
committerSebastian Dröge <slomo@circular-chaos.org>
Wed, 10 Jul 2013 12:30:31 +0000 (14:30 +0200)
Otherwise we'll send a new segment event downstream for each buffer.

plugins/elements/gstinputselector.c

index 9caf5f1c96d100adcc486925441ffef15d077e10..6fcda9347098a85eb3abe29ffdbce5433b9cf6ad 100644 (file)
@@ -504,6 +504,7 @@ gst_selector_pad_event (GstPad * pad, GstObject * parent, GstEvent * event)
           gst_event_set_seqnum (event, selpad->segment_seqnum);
         }
       }
+
       GST_DEBUG_OBJECT (pad, "configured SEGMENT %" GST_SEGMENT_FORMAT,
           &selpad->segment);
       break;
@@ -1037,9 +1038,6 @@ gst_selector_pad_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
     g_object_notify (G_OBJECT (active_sinkpad), "active");
     g_object_notify (G_OBJECT (sel), "active-pad");
   }
-  if (prev_active_sinkpad)
-    gst_object_unref (prev_active_sinkpad);
-  prev_active_sinkpad = NULL;
 
   /* if we have a pending events, push them now */
   if (G_UNLIKELY (prev_active_sinkpad != active_sinkpad
@@ -1049,6 +1047,10 @@ gst_selector_pad_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
     selpad->events_pending = FALSE;
   }
 
+  if (prev_active_sinkpad)
+    gst_object_unref (prev_active_sinkpad);
+  prev_active_sinkpad = NULL;
+
   if (selpad->discont) {
     buf = gst_buffer_make_writable (buf);