Add filler event handling to the queue

Original commit message from CVS:
Add filler event handling to the queue
This commit is contained in:
Jan Schmidt 2005-06-13 11:09:08 +00:00
parent 96f85a23ed
commit e0a051709f
3 changed files with 57 additions and 16 deletions

View file

@ -1,3 +1,8 @@
2005-06-13 Jan Schmidt <thaytan@mad.scientist.com>
* gst/gstqueue.c: (gst_queue_chain), (gst_queue_get):
Add filler event handling.
2005-06-09 David Schleef <ds@schleef.org> 2005-06-09 David Schleef <ds@schleef.org>
* gst/gsttrashstack.h: Fix asm to build on Solaris (#170809) * gst/gsttrashstack.h: Fix asm to build on Solaris (#170809)

View file

@ -588,15 +588,18 @@ restart:
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (data))); GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (data)));
/* We make space available if we're "full" according to whatever /* 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. */ * We always handle events and they don't count in our statistics. */
if (GST_IS_BUFFER (data) && if ((GST_IS_BUFFER (data) ||
((queue->max_size.buffers > 0 && (GST_IS_EVENT (data) && GST_EVENT_TYPE (data) == GST_EVENT_FILLER &&
queue->cur_level.buffers >= queue->max_size.buffers) || gst_event_filler_get_duration (GST_EVENT (data)) !=
(queue->max_size.bytes > 0 && GST_CLOCK_TIME_NONE)) && ((queue->max_size.buffers > 0
queue->cur_level.bytes >= queue->max_size.bytes) || && queue->cur_level.buffers >= queue->max_size.buffers)
(queue->max_size.time > 0 && || (queue->max_size.bytes > 0
queue->cur_level.time >= queue->max_size.time))) { && 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; GST_QUEUE_MUTEX_UNLOCK;
g_signal_emit (G_OBJECT (queue), gst_queue_signals[SIGNAL_OVERRUN], 0); g_signal_emit (G_OBJECT (queue), gst_queue_signals[SIGNAL_OVERRUN], 0);
GST_QUEUE_MUTEX_LOCK; GST_QUEUE_MUTEX_LOCK;
@ -753,6 +756,14 @@ restart:
if (GST_BUFFER_DURATION (data) != GST_CLOCK_TIME_NONE) if (GST_BUFFER_DURATION (data) != GST_CLOCK_TIME_NONE)
queue->cur_level.time += GST_BUFFER_DURATION (data); 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"); STATUS (queue, "+ level");
@ -878,6 +889,13 @@ restart:
"Got buffer of time %" GST_TIME_FORMAT, "Got buffer of time %" GST_TIME_FORMAT,
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (data))); 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 /* Now that we're done, we can lose our own reference to
* the item, since we're no longer in danger. */ * the item, since we're no longer in danger. */

View file

@ -588,15 +588,18 @@ restart:
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (data))); GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (data)));
/* We make space available if we're "full" according to whatever /* 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. */ * We always handle events and they don't count in our statistics. */
if (GST_IS_BUFFER (data) && if ((GST_IS_BUFFER (data) ||
((queue->max_size.buffers > 0 && (GST_IS_EVENT (data) && GST_EVENT_TYPE (data) == GST_EVENT_FILLER &&
queue->cur_level.buffers >= queue->max_size.buffers) || gst_event_filler_get_duration (GST_EVENT (data)) !=
(queue->max_size.bytes > 0 && GST_CLOCK_TIME_NONE)) && ((queue->max_size.buffers > 0
queue->cur_level.bytes >= queue->max_size.bytes) || && queue->cur_level.buffers >= queue->max_size.buffers)
(queue->max_size.time > 0 && || (queue->max_size.bytes > 0
queue->cur_level.time >= queue->max_size.time))) { && 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; GST_QUEUE_MUTEX_UNLOCK;
g_signal_emit (G_OBJECT (queue), gst_queue_signals[SIGNAL_OVERRUN], 0); g_signal_emit (G_OBJECT (queue), gst_queue_signals[SIGNAL_OVERRUN], 0);
GST_QUEUE_MUTEX_LOCK; GST_QUEUE_MUTEX_LOCK;
@ -753,6 +756,14 @@ restart:
if (GST_BUFFER_DURATION (data) != GST_CLOCK_TIME_NONE) if (GST_BUFFER_DURATION (data) != GST_CLOCK_TIME_NONE)
queue->cur_level.time += GST_BUFFER_DURATION (data); 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"); STATUS (queue, "+ level");
@ -878,6 +889,13 @@ restart:
"Got buffer of time %" GST_TIME_FORMAT, "Got buffer of time %" GST_TIME_FORMAT,
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (data))); 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 /* Now that we're done, we can lose our own reference to
* the item, since we're no longer in danger. */ * the item, since we're no longer in danger. */