inputselector: Use the same waiting function for EOS and non-EOS waiting

This commit is contained in:
Sebastian Dröge 2014-12-24 13:46:28 +01:00
parent a1c183417f
commit bc1ec4ec5f

View file

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