mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-09-01 01:33:52 +00:00
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.
This commit is contained in:
parent
46b18f7a8b
commit
6a05291ca2
1 changed files with 33 additions and 18 deletions
|
@ -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
|
/* take the stream lock here, we only want to let the task run when we have
|
||||||
* set the STARTED flag */
|
* set the STARTED flag */
|
||||||
GST_PAD_STREAM_LOCK (basesrc->srcpad);
|
GST_PAD_STREAM_LOCK (basesrc->srcpad);
|
||||||
if (mode == GST_PAD_MODE_PUSH) {
|
switch (mode) {
|
||||||
/* do initial seek, which will start the task */
|
case GST_PAD_MODE_PUSH:
|
||||||
GST_OBJECT_LOCK (basesrc);
|
/* do initial seek, which will start the task */
|
||||||
event = basesrc->pending_seek;
|
GST_OBJECT_LOCK (basesrc);
|
||||||
basesrc->pending_seek = NULL;
|
event = basesrc->pending_seek;
|
||||||
GST_OBJECT_UNLOCK (basesrc);
|
basesrc->pending_seek = NULL;
|
||||||
|
GST_OBJECT_UNLOCK (basesrc);
|
||||||
|
|
||||||
/* The perform seek code will start the task when finished. We don't have to
|
/* 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 */
|
* unlock the streaming thread because it is not running yet */
|
||||||
if (G_UNLIKELY (!gst_base_src_perform_seek (basesrc, event, FALSE)))
|
if (G_UNLIKELY (!gst_base_src_perform_seek (basesrc, event, FALSE)))
|
||||||
goto seek_failed;
|
goto seek_failed;
|
||||||
|
|
||||||
if (event)
|
if (event)
|
||||||
gst_event_unref (event);
|
gst_event_unref (event);
|
||||||
} else {
|
break;
|
||||||
/* if not random_access, we cannot operate in pull mode for now */
|
case GST_PAD_MODE_PULL:
|
||||||
if (G_UNLIKELY (!basesrc->random_access))
|
/* if not random_access, we cannot operate in pull mode for now */
|
||||||
goto no_get_range;
|
if (G_UNLIKELY (!basesrc->random_access))
|
||||||
|
goto no_get_range;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
goto not_activated_yet;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_OBJECT_LOCK (basesrc);
|
GST_OBJECT_LOCK (basesrc);
|
||||||
|
@ -3356,8 +3362,15 @@ no_get_range:
|
||||||
{
|
{
|
||||||
GST_PAD_STREAM_UNLOCK (basesrc->srcpad);
|
GST_PAD_STREAM_UNLOCK (basesrc->srcpad);
|
||||||
gst_base_src_stop (basesrc);
|
gst_base_src_stop (basesrc);
|
||||||
GST_WARNING_OBJECT (basesrc,
|
GST_ERROR_OBJECT (basesrc, "Cannot operate in pull mode, stopping");
|
||||||
"Cannot operate in pull mode, stopping pad task");
|
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;
|
ret = GST_FLOW_ERROR;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -3639,6 +3652,8 @@ gst_base_src_activate_mode (GstPad * pad, GstObject * parent,
|
||||||
|
|
||||||
src->priv->stream_start_pending = FALSE;
|
src->priv->stream_start_pending = FALSE;
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (pad, "activating in mode %d", mode);
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case GST_PAD_MODE_PULL:
|
case GST_PAD_MODE_PULL:
|
||||||
res = gst_base_src_activate_pull (pad, parent, active);
|
res = gst_base_src_activate_pull (pad, parent, active);
|
||||||
|
|
Loading…
Reference in a new issue