input-selector: Fix waiting on EOS
authorJan Alexander Steffens (heftig) <jsteffens@make.tv>
Mon, 23 Mar 2015 12:05:30 +0000 (13:05 +0100)
committerThiago Santos <thiagoss@osg.samsung.com>
Tue, 24 Mar 2015 12:28:44 +0000 (09:28 -0300)
This apparently got broken by bc1ec4e. Since self->blocked is always
FALSE, gst_input_selector_wait never actually waits.

Using (!self->eos || self->blocked) && ... as the loop condition would
be incorrect as well, because then the other call to the function in
_chain would block until EOS, so the functions cannot be merged trivially.

Since blocking is obsolete, gst_input_selector_wait will get removed anyway.
As such, just inline the loop.

https://bugzilla.gnome.org/show_bug.cgi?id=746518

plugins/elements/gstinputselector.c

index e665fcd..b861f56 100644 (file)
@@ -535,9 +535,10 @@ gst_selector_pad_event (GstPad * pad, GstObject * parent, GstEvent * event)
       selpad->eos = TRUE;
 
       if (!forward) {
-        /* blocked until active the sind pad or flush */
-        gst_input_selector_wait (sel, selpad);
         forward = TRUE;
+        /* Wait until we're the active sink pad or we're flushing */
+        while (!sel->eos && !sel->flushing && !selpad->flushing)
+          GST_INPUT_SELECTOR_WAIT (sel);
       } else {
         /* Notify all waiting pads about going EOS now */
         sel->eos = TRUE;