aggregator: rename check_events

This function also handles queries. Update the code to loop until all events and
queuries are handled.
This commit is contained in:
Stefan Sauer 2017-09-17 12:25:37 -07:00 committed by Tim-Philipp Müller
parent 1869886a96
commit 06d62ccb94

View file

@ -750,7 +750,8 @@ gst_aggregator_wait_and_check (GstAggregator * self, gboolean * timeout)
} }
static gboolean static gboolean
check_events (GstAggregator * self, GstAggregatorPad * pad, gpointer user_data) do_events_and_queries (GstAggregator * self, GstAggregatorPad * pad,
gpointer user_data)
{ {
GstEvent *event = NULL; GstEvent *event = NULL;
GstQuery *query = NULL; GstQuery *query = NULL;
@ -759,6 +760,7 @@ check_events (GstAggregator * self, GstAggregatorPad * pad, gpointer user_data)
do { do {
event = NULL; event = NULL;
query = NULL;
PAD_LOCK (pad); PAD_LOCK (pad);
if (pad->priv->num_buffers == 0 && pad->priv->pending_eos) { if (pad->priv->num_buffers == 0 && pad->priv->pending_eos) {
@ -792,9 +794,7 @@ check_events (GstAggregator * self, GstAggregatorPad * pad, gpointer user_data)
if (g_queue_peek_tail (&pad->priv->data) == event) if (g_queue_peek_tail (&pad->priv->data) == event)
gst_event_unref (g_queue_pop_tail (&pad->priv->data)); gst_event_unref (g_queue_pop_tail (&pad->priv->data));
gst_event_unref (event); gst_event_unref (event);
} } else if (query) {
if (query) {
GST_LOG_OBJECT (pad, "Processing %" GST_PTR_FORMAT, query); GST_LOG_OBJECT (pad, "Processing %" GST_PTR_FORMAT, query);
ret = klass->sink_query (self, pad, query); ret = klass->sink_query (self, pad, query);
@ -812,7 +812,7 @@ check_events (GstAggregator * self, GstAggregatorPad * pad, gpointer user_data)
PAD_BROADCAST_EVENT (pad); PAD_BROADCAST_EVENT (pad);
PAD_UNLOCK (pad); PAD_UNLOCK (pad);
} }
} while (event != NULL); } while (event || query);
return TRUE; return TRUE;
} }
@ -1096,12 +1096,13 @@ gst_aggregator_aggregate_func (GstAggregator * self)
GstFlowReturn flow_return = GST_FLOW_OK; GstFlowReturn flow_return = GST_FLOW_OK;
gboolean processed_event = FALSE; gboolean processed_event = FALSE;
gst_aggregator_iterate_sinkpads (self, check_events, NULL); gst_aggregator_iterate_sinkpads (self, do_events_and_queries, NULL);
if (!gst_aggregator_wait_and_check (self, &timeout)) if (!gst_aggregator_wait_and_check (self, &timeout))
continue; continue;
gst_aggregator_iterate_sinkpads (self, check_events, &processed_event); gst_aggregator_iterate_sinkpads (self, do_events_and_queries,
&processed_event);
if (processed_event) if (processed_event)
continue; continue;