guint num_buffers;
GstClockTime head_position;
GstClockTime tail_position;
- GstClockTime head_time;
+ GstClockTime head_time; /* running time */
GstClockTime tail_time;
- GstClockTime time_level;
+ GstClockTime time_level; /* how much head is ahead of tail */
GstSegment head_segment; /* segment before the queue */
gboolean negotiated;
}
static gboolean
-check_events (GstAggregator * self, GstAggregatorPad * pad, gpointer user_data)
+gst_aggregator_do_events_and_queries (GstAggregator * self,
+ GstAggregatorPad * pad, gpointer user_data)
{
GstEvent *event = NULL;
GstQuery *query = NULL;
do {
event = NULL;
+ query = NULL;
PAD_LOCK (pad);
if (pad->priv->num_buffers == 0 && pad->priv->pending_eos) {
if (g_queue_peek_tail (&pad->priv->data) == event)
gst_event_unref (g_queue_pop_tail (&pad->priv->data));
gst_event_unref (event);
- }
-
- if (query) {
+ } else if (query) {
GST_LOG_OBJECT (pad, "Processing %" GST_PTR_FORMAT, query);
ret = klass->sink_query (self, pad, query);
PAD_BROADCAST_EVENT (pad);
PAD_UNLOCK (pad);
}
- } while (event != NULL);
+ } while (event || query);
return TRUE;
}
GstFlowReturn flow_return = GST_FLOW_OK;
gboolean processed_event = FALSE;
- gst_aggregator_iterate_sinkpads (self, check_events, NULL);
+ gst_aggregator_iterate_sinkpads (self, gst_aggregator_do_events_and_queries,
+ NULL);
if (!gst_aggregator_wait_and_check (self, &timeout))
continue;
- gst_aggregator_iterate_sinkpads (self, check_events, &processed_event);
+ gst_aggregator_iterate_sinkpads (self, gst_aggregator_do_events_and_queries,
+ &processed_event);
if (processed_event)
continue;
DEFAULT_START_TIME, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
GST_DEBUG_REGISTER_FUNCPTR (gst_aggregator_stop_pad);
+ GST_DEBUG_REGISTER_FUNCPTR (gst_aggregator_do_events_and_queries);
}
static void
gst_aggregator_pad_clip_buffer_unlocked (pad);
buffer = pad->priv->clipped_buffer;
- pad->priv->clipped_buffer = NULL;
if (buffer) {
+ pad->priv->clipped_buffer = NULL;
gst_aggregator_pad_buffer_consumed (pad);
GST_DEBUG_OBJECT (pad, "Consumed: %" GST_PTR_FORMAT, buffer);
}