mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-26 10:10:32 +00:00
inputselector: Handle stream-group-done
Handle the new stream-group-done message to unblock pads which are waiting for the running time to advance on that group. https://bugzilla.gnome.org/show_bug.cgi?id=768995
This commit is contained in:
parent
9fd2101b36
commit
b50a12b8ac
1 changed files with 26 additions and 3 deletions
|
@ -155,6 +155,9 @@ struct _GstSelectorPad
|
||||||
GstPad parent;
|
GstPad parent;
|
||||||
|
|
||||||
gboolean pushed; /* when buffer was pushed downstream since activation */
|
gboolean pushed; /* when buffer was pushed downstream since activation */
|
||||||
|
guint group_id; /* Group ID from the last stream-start */
|
||||||
|
gboolean group_done; /* when Stream Group Done has been
|
||||||
|
received */
|
||||||
gboolean eos; /* when EOS has been received */
|
gboolean eos; /* when EOS has been received */
|
||||||
gboolean eos_sent; /* when EOS was sent downstream */
|
gboolean eos_sent; /* when EOS was sent downstream */
|
||||||
gboolean discont; /* after switching we create a discont */
|
gboolean discont; /* after switching we create a discont */
|
||||||
|
@ -340,6 +343,7 @@ gst_selector_pad_reset (GstSelectorPad * pad)
|
||||||
{
|
{
|
||||||
GST_OBJECT_LOCK (pad);
|
GST_OBJECT_LOCK (pad);
|
||||||
pad->pushed = FALSE;
|
pad->pushed = FALSE;
|
||||||
|
pad->group_done = FALSE;
|
||||||
pad->eos = FALSE;
|
pad->eos = FALSE;
|
||||||
pad->eos_sent = FALSE;
|
pad->eos_sent = FALSE;
|
||||||
pad->events_pending = FALSE;
|
pad->events_pending = FALSE;
|
||||||
|
@ -550,16 +554,17 @@ gst_selector_pad_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
||||||
|
|
||||||
switch (GST_EVENT_TYPE (event)) {
|
switch (GST_EVENT_TYPE (event)) {
|
||||||
case GST_EVENT_STREAM_START:{
|
case GST_EVENT_STREAM_START:{
|
||||||
guint group_id;
|
if (!gst_event_parse_group_id (event, &selpad->group_id)) {
|
||||||
|
|
||||||
if (!gst_event_parse_group_id (event, &group_id))
|
|
||||||
sel->have_group_id = FALSE;
|
sel->have_group_id = FALSE;
|
||||||
|
selpad->group_id = 0;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GST_EVENT_FLUSH_START:
|
case GST_EVENT_FLUSH_START:
|
||||||
/* Unblock the pad if it's waiting */
|
/* Unblock the pad if it's waiting */
|
||||||
selpad->flushing = TRUE;
|
selpad->flushing = TRUE;
|
||||||
sel->eos = FALSE;
|
sel->eos = FALSE;
|
||||||
|
selpad->group_done = FALSE;
|
||||||
GST_INPUT_SELECTOR_BROADCAST (sel);
|
GST_INPUT_SELECTOR_BROADCAST (sel);
|
||||||
break;
|
break;
|
||||||
case GST_EVENT_FLUSH_STOP:
|
case GST_EVENT_FLUSH_STOP:
|
||||||
|
@ -626,6 +631,15 @@ gst_selector_pad_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case GST_EVENT_STREAM_GROUP_DONE:{
|
||||||
|
GST_DEBUG_OBJECT (sel, "Stream group-done in inputselector pad %s",
|
||||||
|
GST_OBJECT_NAME (selpad));
|
||||||
|
gst_event_parse_stream_group_done (event, &selpad->group_id);
|
||||||
|
selpad->group_done = TRUE;
|
||||||
|
if (sel->sync_streams && active_sinkpad == pad)
|
||||||
|
GST_INPUT_SELECTOR_BROADCAST (sel);
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -798,6 +812,15 @@ gst_input_selector_wait_running_time (GstInputSelector * sel,
|
||||||
GST_FORMAT_TIME, active_seg->position);
|
GST_FORMAT_TIME, active_seg->position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Don't wait if the group is finished on the active pad,
|
||||||
|
* as the running time won't progress now */
|
||||||
|
if (selpad != active_selpad && active_selpad->group_done &&
|
||||||
|
selpad->group_id == active_selpad->group_id) {
|
||||||
|
GST_DEBUG_OBJECT (selpad, "Active pad received group-done. Unblocking");
|
||||||
|
GST_INPUT_SELECTOR_UNLOCK (sel);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (selpad != active_selpad && !sel->eos && !sel->flushing
|
if (selpad != active_selpad && !sel->eos && !sel->flushing
|
||||||
&& !selpad->flushing && (cur_running_time == GST_CLOCK_TIME_NONE
|
&& !selpad->flushing && (cur_running_time == GST_CLOCK_TIME_NONE
|
||||||
|| running_time >= cur_running_time)) {
|
|| running_time >= cur_running_time)) {
|
||||||
|
|
Loading…
Reference in a new issue