diff --git a/ChangeLog b/ChangeLog index f9436fa969..b88344b51a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-06-13 Jan Schmidt + + * gst/gstqueue.c: (gst_queue_chain), (gst_queue_get): + Add filler event handling. + 2005-06-09 David Schleef * gst/gsttrashstack.h: Fix asm to build on Solaris (#170809) diff --git a/gst/gstqueue.c b/gst/gstqueue.c index af9fa30b4c..0d388cf5a4 100644 --- a/gst/gstqueue.c +++ b/gst/gstqueue.c @@ -588,15 +588,18 @@ restart: GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (data))); /* We make space available if we're "full" according to whatever - * the user defined as "full". Note that this only applies to buffers. + * the user defined as "full". Note that this only applies to buffers, + * and filler events with a duration * We always handle events and they don't count in our statistics. */ - if (GST_IS_BUFFER (data) && - ((queue->max_size.buffers > 0 && - queue->cur_level.buffers >= queue->max_size.buffers) || - (queue->max_size.bytes > 0 && - queue->cur_level.bytes >= queue->max_size.bytes) || - (queue->max_size.time > 0 && - queue->cur_level.time >= queue->max_size.time))) { + if ((GST_IS_BUFFER (data) || + (GST_IS_EVENT (data) && GST_EVENT_TYPE (data) == GST_EVENT_FILLER && + gst_event_filler_get_duration (GST_EVENT (data)) != + GST_CLOCK_TIME_NONE)) && ((queue->max_size.buffers > 0 + && queue->cur_level.buffers >= queue->max_size.buffers) + || (queue->max_size.bytes > 0 + && queue->cur_level.bytes >= queue->max_size.bytes) + || (queue->max_size.time > 0 + && queue->cur_level.time >= queue->max_size.time))) { GST_QUEUE_MUTEX_UNLOCK; g_signal_emit (G_OBJECT (queue), gst_queue_signals[SIGNAL_OVERRUN], 0); GST_QUEUE_MUTEX_LOCK; @@ -753,6 +756,14 @@ restart: if (GST_BUFFER_DURATION (data) != GST_CLOCK_TIME_NONE) queue->cur_level.time += GST_BUFFER_DURATION (data); } + if (GST_IS_EVENT (data) && GST_EVENT_TYPE (data) == GST_EVENT_FILLER) { + gint64 dur = gst_event_filler_get_duration (GST_EVENT (data)); + + if (dur != GST_CLOCK_TIME_NONE) { + queue->cur_level.time += dur; + } + } + STATUS (queue, "+ level"); @@ -878,6 +889,13 @@ restart: "Got buffer of time %" GST_TIME_FORMAT, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (data))); } + if (GST_IS_EVENT (data) && GST_EVENT_TYPE (data) == GST_EVENT_FILLER) { + gint64 dur = gst_event_filler_get_duration (GST_EVENT (data)); + + if (dur != GST_CLOCK_TIME_NONE) { + queue->cur_level.time -= dur; + } + } /* Now that we're done, we can lose our own reference to * the item, since we're no longer in danger. */ diff --git a/plugins/elements/gstqueue.c b/plugins/elements/gstqueue.c index af9fa30b4c..0d388cf5a4 100644 --- a/plugins/elements/gstqueue.c +++ b/plugins/elements/gstqueue.c @@ -588,15 +588,18 @@ restart: GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (data))); /* We make space available if we're "full" according to whatever - * the user defined as "full". Note that this only applies to buffers. + * the user defined as "full". Note that this only applies to buffers, + * and filler events with a duration * We always handle events and they don't count in our statistics. */ - if (GST_IS_BUFFER (data) && - ((queue->max_size.buffers > 0 && - queue->cur_level.buffers >= queue->max_size.buffers) || - (queue->max_size.bytes > 0 && - queue->cur_level.bytes >= queue->max_size.bytes) || - (queue->max_size.time > 0 && - queue->cur_level.time >= queue->max_size.time))) { + if ((GST_IS_BUFFER (data) || + (GST_IS_EVENT (data) && GST_EVENT_TYPE (data) == GST_EVENT_FILLER && + gst_event_filler_get_duration (GST_EVENT (data)) != + GST_CLOCK_TIME_NONE)) && ((queue->max_size.buffers > 0 + && queue->cur_level.buffers >= queue->max_size.buffers) + || (queue->max_size.bytes > 0 + && queue->cur_level.bytes >= queue->max_size.bytes) + || (queue->max_size.time > 0 + && queue->cur_level.time >= queue->max_size.time))) { GST_QUEUE_MUTEX_UNLOCK; g_signal_emit (G_OBJECT (queue), gst_queue_signals[SIGNAL_OVERRUN], 0); GST_QUEUE_MUTEX_LOCK; @@ -753,6 +756,14 @@ restart: if (GST_BUFFER_DURATION (data) != GST_CLOCK_TIME_NONE) queue->cur_level.time += GST_BUFFER_DURATION (data); } + if (GST_IS_EVENT (data) && GST_EVENT_TYPE (data) == GST_EVENT_FILLER) { + gint64 dur = gst_event_filler_get_duration (GST_EVENT (data)); + + if (dur != GST_CLOCK_TIME_NONE) { + queue->cur_level.time += dur; + } + } + STATUS (queue, "+ level"); @@ -878,6 +889,13 @@ restart: "Got buffer of time %" GST_TIME_FORMAT, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (data))); } + if (GST_IS_EVENT (data) && GST_EVENT_TYPE (data) == GST_EVENT_FILLER) { + gint64 dur = gst_event_filler_get_duration (GST_EVENT (data)); + + if (dur != GST_CLOCK_TIME_NONE) { + queue->cur_level.time -= dur; + } + } /* Now that we're done, we can lose our own reference to * the item, since we're no longer in danger. */