From dffab828c6e04aa2e03143e41d65ee5c5bb36b96 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 11 Aug 2010 08:46:14 +0200 Subject: [PATCH] imagefreeze: Return GST_FLOW_UNEXPECTED when getting a second buffer This prevents upstream from pushing many useless buffers and makes it go into EOS state. --- gst/imagefreeze/gstimagefreeze.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/gst/imagefreeze/gstimagefreeze.c b/gst/imagefreeze/gstimagefreeze.c index 78ccda0..0db2e86 100644 --- a/gst/imagefreeze/gstimagefreeze.c +++ b/gst/imagefreeze/gstimagefreeze.c @@ -332,8 +332,8 @@ gst_image_freeze_sink_bufferalloc (GstPad * pad, guint64 offset, guint size, GST_ERROR_OBJECT (pad, "Allocating buffer failed: %s", gst_flow_get_name (ret)); } else { - /* In this case GstPad will allocate a buffer for us */ - ret = GST_FLOW_OK; + /* Let upstream go EOS if we already have a buffer */ + ret = GST_FLOW_UNEXPECTED; } gst_object_unref (self); @@ -687,14 +687,13 @@ static GstFlowReturn gst_image_freeze_sink_chain (GstPad * pad, GstBuffer * buffer) { GstImageFreeze *self = GST_IMAGE_FREEZE (GST_PAD_PARENT (pad)); - GstFlowReturn ret = GST_FLOW_OK; GST_OBJECT_LOCK (self); if (self->buffer) { GST_DEBUG_OBJECT (pad, "Already have a buffer, dropping"); gst_buffer_unref (buffer); GST_OBJECT_UNLOCK (self); - return ret; + return GST_FLOW_UNEXPECTED; } self->buffer = buffer; @@ -702,7 +701,7 @@ gst_image_freeze_sink_chain (GstPad * pad, GstBuffer * buffer) gst_pad_start_task (self->srcpad, (GstTaskFunction) gst_image_freeze_src_loop, self->srcpad); - return ret; + return GST_FLOW_OK; } static void -- 2.7.4