From: Stefan Sauer Date: Mon, 6 Jan 2014 20:47:22 +0000 (+0100) Subject: basesrc: don't confuse GST_PAD_MODE_NONE and PULL X-Git-Tag: 1.3.1~228 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6a05291ca2ec8f232f14c7c393bd5bdd1d24fda3;p=platform%2Fupstream%2Fgstreamer.git basesrc: don't confuse GST_PAD_MODE_NONE and PULL Use a switch-case to explicitly handle all pad-modes. This way we don't log an error when the pad is not yet activated. --- diff --git a/libs/gst/base/gstbasesrc.c b/libs/gst/base/gstbasesrc.c index b69ac879..d51fb11 100644 --- a/libs/gst/base/gstbasesrc.c +++ b/libs/gst/base/gstbasesrc.c @@ -3311,24 +3311,30 @@ gst_base_src_start_complete (GstBaseSrc * basesrc, GstFlowReturn ret) /* take the stream lock here, we only want to let the task run when we have * set the STARTED flag */ GST_PAD_STREAM_LOCK (basesrc->srcpad); - if (mode == GST_PAD_MODE_PUSH) { - /* do initial seek, which will start the task */ - GST_OBJECT_LOCK (basesrc); - event = basesrc->pending_seek; - basesrc->pending_seek = NULL; - GST_OBJECT_UNLOCK (basesrc); - - /* The perform seek code will start the task when finished. We don't have to - * unlock the streaming thread because it is not running yet */ - if (G_UNLIKELY (!gst_base_src_perform_seek (basesrc, event, FALSE))) - goto seek_failed; - - if (event) - gst_event_unref (event); - } else { - /* if not random_access, we cannot operate in pull mode for now */ - if (G_UNLIKELY (!basesrc->random_access)) - goto no_get_range; + switch (mode) { + case GST_PAD_MODE_PUSH: + /* do initial seek, which will start the task */ + GST_OBJECT_LOCK (basesrc); + event = basesrc->pending_seek; + basesrc->pending_seek = NULL; + GST_OBJECT_UNLOCK (basesrc); + + /* The perform seek code will start the task when finished. We don't have to + * unlock the streaming thread because it is not running yet */ + if (G_UNLIKELY (!gst_base_src_perform_seek (basesrc, event, FALSE))) + goto seek_failed; + + if (event) + gst_event_unref (event); + break; + case GST_PAD_MODE_PULL: + /* if not random_access, we cannot operate in pull mode for now */ + if (G_UNLIKELY (!basesrc->random_access)) + goto no_get_range; + break; + default: + goto not_activated_yet; + break; } GST_OBJECT_LOCK (basesrc); @@ -3356,8 +3362,15 @@ no_get_range: { GST_PAD_STREAM_UNLOCK (basesrc->srcpad); gst_base_src_stop (basesrc); - GST_WARNING_OBJECT (basesrc, - "Cannot operate in pull mode, stopping pad task"); + GST_ERROR_OBJECT (basesrc, "Cannot operate in pull mode, stopping"); + ret = GST_FLOW_ERROR; + goto error; + } +not_activated_yet: + { + GST_PAD_STREAM_UNLOCK (basesrc->srcpad); + gst_base_src_stop (basesrc); + GST_WARNING_OBJECT (basesrc, "pad not activated yet"); ret = GST_FLOW_ERROR; goto error; } @@ -3639,6 +3652,8 @@ gst_base_src_activate_mode (GstPad * pad, GstObject * parent, src->priv->stream_start_pending = FALSE; + GST_DEBUG_OBJECT (pad, "activating in mode %d", mode); + switch (mode) { case GST_PAD_MODE_PULL: res = gst_base_src_activate_pull (pad, parent, active);