mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 12:49:40 +00:00
basesrc: remove 0.11 fixme
We always require elements to have an unlock_stop vmethod.
This commit is contained in:
parent
cdf1cc0cf5
commit
42e755f7c3
1 changed files with 26 additions and 37 deletions
|
@ -318,7 +318,7 @@ static gboolean gst_base_src_decide_allocation_default (GstBaseSrc * basesrc,
|
||||||
GstQuery * query);
|
GstQuery * query);
|
||||||
|
|
||||||
static gboolean gst_base_src_set_flushing (GstBaseSrc * basesrc,
|
static gboolean gst_base_src_set_flushing (GstBaseSrc * basesrc,
|
||||||
gboolean flushing, gboolean live_play, gboolean unlock, gboolean * playing);
|
gboolean flushing, gboolean live_play, gboolean * playing);
|
||||||
|
|
||||||
static gboolean gst_base_src_start (GstBaseSrc * basesrc);
|
static gboolean gst_base_src_start (GstBaseSrc * basesrc);
|
||||||
static gboolean gst_base_src_stop (GstBaseSrc * basesrc);
|
static gboolean gst_base_src_stop (GstBaseSrc * basesrc);
|
||||||
|
@ -1481,15 +1481,8 @@ not_ok:
|
||||||
* when we reach the segment.stop we have to post a segment.done
|
* when we reach the segment.stop we have to post a segment.done
|
||||||
* instead of EOS when doing a segment seek.
|
* instead of EOS when doing a segment seek.
|
||||||
*/
|
*/
|
||||||
/* FIXME (0.11), we have the unlock gboolean here because most current
|
|
||||||
* implementations (fdsrc, -base/gst/tcp/, ...) unconditionally unlock, even when
|
|
||||||
* the streaming thread isn't running, resulting in bogus unlocks later when it
|
|
||||||
* starts. This is fixed by adding unlock_stop, but we should still avoid unlocking
|
|
||||||
* unnecessarily for backwards compatibility. Ergo, the unlock variable stays
|
|
||||||
* until 0.11
|
|
||||||
*/
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_base_src_perform_seek (GstBaseSrc * src, GstEvent * event, gboolean unlock)
|
gst_base_src_perform_seek (GstBaseSrc * src, GstEvent * event)
|
||||||
{
|
{
|
||||||
gboolean res = TRUE, tres;
|
gboolean res = TRUE, tres;
|
||||||
gdouble rate;
|
gdouble rate;
|
||||||
|
@ -1548,7 +1541,7 @@ gst_base_src_perform_seek (GstBaseSrc * src, GstEvent * event, gboolean unlock)
|
||||||
gst_pad_pause_task (src->srcpad);
|
gst_pad_pause_task (src->srcpad);
|
||||||
|
|
||||||
/* unblock streaming thread. */
|
/* unblock streaming thread. */
|
||||||
gst_base_src_set_flushing (src, TRUE, FALSE, unlock, &playing);
|
gst_base_src_set_flushing (src, TRUE, FALSE, &playing);
|
||||||
|
|
||||||
/* grab streaming lock, this should eventually be possible, either
|
/* grab streaming lock, this should eventually be possible, either
|
||||||
* because the task is paused, our streaming thread stopped
|
* because the task is paused, our streaming thread stopped
|
||||||
|
@ -1563,7 +1556,7 @@ gst_base_src_perform_seek (GstBaseSrc * src, GstEvent * event, gboolean unlock)
|
||||||
GST_DEBUG_OBJECT (src, "seek with seqnum %" G_GUINT32_FORMAT, seqnum);
|
GST_DEBUG_OBJECT (src, "seek with seqnum %" G_GUINT32_FORMAT, seqnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_base_src_set_flushing (src, FALSE, playing, unlock, NULL);
|
gst_base_src_set_flushing (src, FALSE, playing, NULL);
|
||||||
|
|
||||||
/* If we configured the seeksegment above, don't overwrite it now. Otherwise
|
/* If we configured the seeksegment above, don't overwrite it now. Otherwise
|
||||||
* copy the current segment info into the temp segment that we can actually
|
* copy the current segment info into the temp segment that we can actually
|
||||||
|
@ -1767,8 +1760,8 @@ gst_base_src_send_event (GstElement * element, GstEvent * event)
|
||||||
if (started) {
|
if (started) {
|
||||||
GST_DEBUG_OBJECT (src, "performing seek");
|
GST_DEBUG_OBJECT (src, "performing seek");
|
||||||
/* when we are running in push mode, we can execute the
|
/* when we are running in push mode, we can execute the
|
||||||
* seek right now, we need to unlock. */
|
* seek right now. */
|
||||||
result = gst_base_src_perform_seek (src, event, TRUE);
|
result = gst_base_src_perform_seek (src, event);
|
||||||
} else {
|
} else {
|
||||||
GstEvent **event_p;
|
GstEvent **event_p;
|
||||||
|
|
||||||
|
@ -1863,15 +1856,15 @@ gst_base_src_default_event (GstBaseSrc * src, GstEvent * event)
|
||||||
if (!gst_base_src_seekable (src))
|
if (!gst_base_src_seekable (src))
|
||||||
goto not_seekable;
|
goto not_seekable;
|
||||||
|
|
||||||
result = gst_base_src_perform_seek (src, event, TRUE);
|
result = gst_base_src_perform_seek (src, event);
|
||||||
break;
|
break;
|
||||||
case GST_EVENT_FLUSH_START:
|
case GST_EVENT_FLUSH_START:
|
||||||
/* cancel any blocking getrange, is normally called
|
/* cancel any blocking getrange, is normally called
|
||||||
* when in pull mode. */
|
* when in pull mode. */
|
||||||
result = gst_base_src_set_flushing (src, TRUE, FALSE, TRUE, NULL);
|
result = gst_base_src_set_flushing (src, TRUE, FALSE, NULL);
|
||||||
break;
|
break;
|
||||||
case GST_EVENT_FLUSH_STOP:
|
case GST_EVENT_FLUSH_STOP:
|
||||||
result = gst_base_src_set_flushing (src, FALSE, TRUE, TRUE, NULL);
|
result = gst_base_src_set_flushing (src, FALSE, TRUE, NULL);
|
||||||
break;
|
break;
|
||||||
case GST_EVENT_QOS:
|
case GST_EVENT_QOS:
|
||||||
{
|
{
|
||||||
|
@ -3130,7 +3123,7 @@ gst_base_src_start_complete (GstBaseSrc * basesrc, GstFlowReturn ret)
|
||||||
|
|
||||||
/* stop flushing now but for live sources, still block in the LIVE lock when
|
/* stop flushing now but for live sources, still block in the LIVE lock when
|
||||||
* we are not yet PLAYING */
|
* we are not yet PLAYING */
|
||||||
gst_base_src_set_flushing (basesrc, FALSE, FALSE, FALSE, NULL);
|
gst_base_src_set_flushing (basesrc, FALSE, FALSE, NULL);
|
||||||
|
|
||||||
gst_pad_mark_reconfigure (GST_BASE_SRC_PAD (basesrc));
|
gst_pad_mark_reconfigure (GST_BASE_SRC_PAD (basesrc));
|
||||||
|
|
||||||
|
@ -3148,10 +3141,8 @@ gst_base_src_start_complete (GstBaseSrc * basesrc, GstFlowReturn ret)
|
||||||
basesrc->pending_seek = NULL;
|
basesrc->pending_seek = NULL;
|
||||||
GST_OBJECT_UNLOCK (basesrc);
|
GST_OBJECT_UNLOCK (basesrc);
|
||||||
|
|
||||||
/* no need to unlock anything, the task is certainly
|
/* The perform seek code will start the task when finished. */
|
||||||
* not running here. The perform seek code will start the task when
|
if (G_UNLIKELY (!gst_base_src_perform_seek (basesrc, event)))
|
||||||
* finished. */
|
|
||||||
if (G_UNLIKELY (!gst_base_src_perform_seek (basesrc, event, FALSE)))
|
|
||||||
goto seek_failed;
|
goto seek_failed;
|
||||||
|
|
||||||
if (event)
|
if (event)
|
||||||
|
@ -3177,7 +3168,7 @@ seek_failed:
|
||||||
{
|
{
|
||||||
GST_PAD_STREAM_UNLOCK (basesrc->srcpad);
|
GST_PAD_STREAM_UNLOCK (basesrc->srcpad);
|
||||||
GST_ERROR_OBJECT (basesrc, "Failed to perform initial seek");
|
GST_ERROR_OBJECT (basesrc, "Failed to perform initial seek");
|
||||||
gst_base_src_set_flushing (basesrc, TRUE, FALSE, TRUE, NULL);
|
gst_base_src_set_flushing (basesrc, TRUE, FALSE, NULL);
|
||||||
if (event)
|
if (event)
|
||||||
gst_event_unref (event);
|
gst_event_unref (event);
|
||||||
ret = GST_FLOW_ERROR;
|
ret = GST_FLOW_ERROR;
|
||||||
|
@ -3186,7 +3177,7 @@ seek_failed:
|
||||||
no_get_range:
|
no_get_range:
|
||||||
{
|
{
|
||||||
GST_PAD_STREAM_UNLOCK (basesrc->srcpad);
|
GST_PAD_STREAM_UNLOCK (basesrc->srcpad);
|
||||||
gst_base_src_set_flushing (basesrc, TRUE, FALSE, TRUE, NULL);
|
gst_base_src_set_flushing (basesrc, TRUE, FALSE, NULL);
|
||||||
GST_ERROR_OBJECT (basesrc, "Cannot operate in pull mode, stopping");
|
GST_ERROR_OBJECT (basesrc, "Cannot operate in pull mode, stopping");
|
||||||
ret = GST_FLOW_ERROR;
|
ret = GST_FLOW_ERROR;
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -3248,7 +3239,7 @@ gst_base_src_stop (GstBaseSrc * basesrc)
|
||||||
GST_DEBUG_OBJECT (basesrc, "stopping source");
|
GST_DEBUG_OBJECT (basesrc, "stopping source");
|
||||||
|
|
||||||
/* flush all */
|
/* flush all */
|
||||||
gst_base_src_set_flushing (basesrc, TRUE, FALSE, TRUE, NULL);
|
gst_base_src_set_flushing (basesrc, TRUE, FALSE, NULL);
|
||||||
/* stop the task */
|
/* stop the task */
|
||||||
gst_pad_stop_task (basesrc->srcpad);
|
gst_pad_stop_task (basesrc->srcpad);
|
||||||
|
|
||||||
|
@ -3282,13 +3273,13 @@ was_stopped:
|
||||||
*/
|
*/
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_base_src_set_flushing (GstBaseSrc * basesrc,
|
gst_base_src_set_flushing (GstBaseSrc * basesrc,
|
||||||
gboolean flushing, gboolean live_play, gboolean unlock, gboolean * playing)
|
gboolean flushing, gboolean live_play, gboolean * playing)
|
||||||
{
|
{
|
||||||
GstBaseSrcClass *bclass;
|
GstBaseSrcClass *bclass;
|
||||||
|
|
||||||
bclass = GST_BASE_SRC_GET_CLASS (basesrc);
|
bclass = GST_BASE_SRC_GET_CLASS (basesrc);
|
||||||
|
|
||||||
if (flushing && unlock) {
|
if (flushing) {
|
||||||
gst_base_src_activate_pool (basesrc, FALSE);
|
gst_base_src_activate_pool (basesrc, FALSE);
|
||||||
/* unlock any subclasses, we need to do this before grabbing the
|
/* unlock any subclasses, we need to do this before grabbing the
|
||||||
* LIVE_LOCK since we hold this lock before going into ::create. We pass an
|
* LIVE_LOCK since we hold this lock before going into ::create. We pass an
|
||||||
|
@ -3323,18 +3314,16 @@ gst_base_src_set_flushing (GstBaseSrc * basesrc,
|
||||||
|
|
||||||
gst_base_src_activate_pool (basesrc, TRUE);
|
gst_base_src_activate_pool (basesrc, TRUE);
|
||||||
|
|
||||||
/* When unlocking drop all delayed events */
|
/* Drop all delayed events */
|
||||||
if (unlock) {
|
GST_OBJECT_LOCK (basesrc);
|
||||||
GST_OBJECT_LOCK (basesrc);
|
if (basesrc->priv->pending_events) {
|
||||||
if (basesrc->priv->pending_events) {
|
g_list_foreach (basesrc->priv->pending_events, (GFunc) gst_event_unref,
|
||||||
g_list_foreach (basesrc->priv->pending_events, (GFunc) gst_event_unref,
|
NULL);
|
||||||
NULL);
|
g_list_free (basesrc->priv->pending_events);
|
||||||
g_list_free (basesrc->priv->pending_events);
|
basesrc->priv->pending_events = NULL;
|
||||||
basesrc->priv->pending_events = NULL;
|
g_atomic_int_set (&basesrc->priv->have_events, FALSE);
|
||||||
g_atomic_int_set (&basesrc->priv->have_events, FALSE);
|
|
||||||
}
|
|
||||||
GST_OBJECT_UNLOCK (basesrc);
|
|
||||||
}
|
}
|
||||||
|
GST_OBJECT_UNLOCK (basesrc);
|
||||||
}
|
}
|
||||||
GST_LIVE_SIGNAL (basesrc);
|
GST_LIVE_SIGNAL (basesrc);
|
||||||
GST_LIVE_UNLOCK (basesrc);
|
GST_LIVE_UNLOCK (basesrc);
|
||||||
|
|
Loading…
Reference in a new issue