inputselector: Use the same waiting function for EOS and non-EOS waiting
authorSebastian Dröge <sebastian@centricular.com>
Wed, 24 Dec 2014 12:46:28 +0000 (13:46 +0100)
committerSebastian Dröge <sebastian@centricular.com>
Wed, 24 Dec 2014 12:46:28 +0000 (13:46 +0100)
plugins/elements/gstinputselector.c

index 29754cd..b5da039 100644 (file)
@@ -434,10 +434,12 @@ gst_selector_pad_iterate_linked_pads (GstPad * pad, GstObject * parent)
   return it;
 }
 
+/* must be called with the SELECTOR_LOCK, will block while the pad is blocked 
+ * or return TRUE when flushing */
 static gboolean
-gst_input_selector_eos_wait (GstInputSelector * self, GstSelectorPad * pad)
+gst_input_selector_wait (GstInputSelector * self, GstSelectorPad * pad)
 {
-  while (!self->eos && !self->flushing && !pad->flushing) {
+  while (!self->eos && self->blocked && !self->flushing && !pad->flushing) {
     /* we can be unlocked here when we are shutting down (flushing) or when we
      * get unblocked */
     GST_INPUT_SELECTOR_WAIT (self);
@@ -534,7 +536,7 @@ gst_selector_pad_event (GstPad * pad, GstObject * parent, GstEvent * event)
 
       if (!forward) {
         /* blocked until active the sind pad or flush */
-        gst_input_selector_eos_wait (sel, selpad);
+        gst_input_selector_wait (sel, selpad);
         forward = TRUE;
       } else {
         /* Notify all waiting pads about going EOS now */
@@ -629,19 +631,6 @@ done:
   return res;
 }
 
-/* must be called with the SELECTOR_LOCK, will block while the pad is blocked 
- * or return TRUE when flushing */
-static gboolean
-gst_input_selector_wait (GstInputSelector * self, GstSelectorPad * pad)
-{
-  while (self->blocked && !self->flushing && !pad->flushing) {
-    /* we can be unlocked here when we are shutting down (flushing) or when we
-     * get unblocked */
-    GST_INPUT_SELECTOR_WAIT (self);
-  }
-  return self->flushing;
-}
-
 static GstClockTime
 gst_input_selector_get_clipped_running_time (GstSegment * seg, GstBuffer * buf)
 {