videomixer: Only pop buffers from collectpads after they're fully consumed

This decreases latency and memory usage because new buffers are only
accepted by collectpads if there's no queued buffer.
This commit is contained in:
Sebastian Dröge 2009-12-09 21:03:57 +01:00
parent cd888c0531
commit 7418dee253

View file

@ -1135,8 +1135,7 @@ gst_videomixer_fill_queues (GstVideoMixer * mix)
GST_LOG_OBJECT (mix, "we need a new buffer"); GST_LOG_OBJECT (mix, "we need a new buffer");
buf = gst_collect_pads_pop (mix->collect, data); buf = gst_collect_pads_peek (mix->collect, data);
if (buf) { if (buf) {
guint64 duration; guint64 duration;
@ -1289,6 +1288,8 @@ gst_videomixer_update_queues (GstVideoMixer * mix)
GST_LOG_OBJECT (pad, "queued now %" G_GINT64_FORMAT, pad->queued); GST_LOG_OBJECT (pad, "queued now %" G_GINT64_FORMAT, pad->queued);
if (pad->queued <= 0) { if (pad->queued <= 0) {
GST_LOG_OBJECT (pad, "unreffing buffer"); GST_LOG_OBJECT (pad, "unreffing buffer");
gst_buffer_unref (gst_collect_pads_pop (mix->collect,
&mixcol->collect));
gst_buffer_unref (mixcol->buffer); gst_buffer_unref (mixcol->buffer);
mixcol->buffer = NULL; mixcol->buffer = NULL;
} }