mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-19 05:45:58 +00:00
basesrc: Handle tag and custom downstream events the same
Especially drop tag events when flushing to not send them over and over again. Should've been in the last commit already but I forgot to call git rebase --continue...
This commit is contained in:
parent
c7c3e46b08
commit
7945821f92
1 changed files with 2 additions and 37 deletions
|
@ -240,9 +240,6 @@ struct _GstBaseSrcPrivate
|
|||
|
||||
/* pending events (TAG, CUSTOM_BOTH, CUSTOM_DOWNSTREAM) to be
|
||||
* pushed in the data stream */
|
||||
GList *pending_tags;
|
||||
volatile gint have_tags;
|
||||
|
||||
GList *pending_events;
|
||||
volatile gint have_events;
|
||||
|
||||
|
@ -443,7 +440,6 @@ gst_base_src_init (GstBaseSrc * basesrc, gpointer g_class)
|
|||
basesrc->data.ABI.typefind = DEFAULT_TYPEFIND;
|
||||
basesrc->priv->do_timestamp = DEFAULT_DO_TIMESTAMP;
|
||||
g_atomic_int_set (&basesrc->priv->have_events, FALSE);
|
||||
g_atomic_int_set (&basesrc->priv->have_tags, FALSE);
|
||||
|
||||
GST_OBJECT_FLAG_UNSET (basesrc, GST_BASE_SRC_STARTED);
|
||||
GST_OBJECT_FLAG_SET (basesrc, GST_ELEMENT_IS_SOURCE);
|
||||
|
@ -465,11 +461,6 @@ gst_base_src_finalize (GObject * object)
|
|||
event_p = &basesrc->data.ABI.pending_seek;
|
||||
gst_event_replace (event_p, NULL);
|
||||
|
||||
if (basesrc->priv->pending_tags) {
|
||||
g_list_foreach (basesrc->priv->pending_tags, (GFunc) gst_event_unref, NULL);
|
||||
g_list_free (basesrc->priv->pending_tags);
|
||||
}
|
||||
|
||||
if (basesrc->priv->pending_events) {
|
||||
g_list_foreach (basesrc->priv->pending_events, (GFunc) gst_event_unref,
|
||||
NULL);
|
||||
|
@ -1597,17 +1588,9 @@ gst_base_src_send_event (GstElement * element, GstEvent * event)
|
|||
/* sending random NEWSEGMENT downstream can break sync. */
|
||||
break;
|
||||
case GST_EVENT_TAG:
|
||||
/* Insert TAG in the dataflow */
|
||||
GST_OBJECT_LOCK (src);
|
||||
src->priv->pending_tags = g_list_append (src->priv->pending_tags, event);
|
||||
g_atomic_int_set (&src->priv->have_tags, TRUE);
|
||||
GST_OBJECT_UNLOCK (src);
|
||||
event = NULL;
|
||||
result = TRUE;
|
||||
break;
|
||||
case GST_EVENT_CUSTOM_DOWNSTREAM:
|
||||
case GST_EVENT_CUSTOM_BOTH:
|
||||
/* Insert CUSTOM_DOWNSTREAM, CUSTOM_BOTH in the dataflow */
|
||||
/* Insert TAG, CUSTOM_DOWNSTREAM, CUSTOM_BOTH in the dataflow */
|
||||
GST_OBJECT_LOCK (src);
|
||||
src->priv->pending_events =
|
||||
g_list_append (src->priv->pending_events, event);
|
||||
|
@ -2374,7 +2357,7 @@ gst_base_src_loop (GstPad * pad)
|
|||
gint64 position;
|
||||
gboolean eos;
|
||||
gulong blocksize;
|
||||
GList *pending_tags = NULL, *pending_events = NULL, *tmp;
|
||||
GList *pending_events = NULL, *tmp;
|
||||
|
||||
eos = FALSE;
|
||||
|
||||
|
@ -2431,24 +2414,6 @@ gst_base_src_loop (GstPad * pad)
|
|||
}
|
||||
src->priv->newsegment_pending = FALSE;
|
||||
|
||||
if (g_atomic_int_get (&src->priv->have_tags)) {
|
||||
GST_OBJECT_LOCK (src);
|
||||
/* take the events */
|
||||
pending_tags = src->priv->pending_tags;
|
||||
src->priv->pending_tags = NULL;
|
||||
g_atomic_int_set (&src->priv->have_tags, FALSE);
|
||||
GST_OBJECT_UNLOCK (src);
|
||||
}
|
||||
|
||||
/* Push out pending tags if any */
|
||||
if (G_UNLIKELY (pending_tags != NULL)) {
|
||||
for (tmp = pending_tags; tmp; tmp = g_list_next (tmp)) {
|
||||
GstEvent *ev = (GstEvent *) tmp->data;
|
||||
gst_pad_push_event (pad, ev);
|
||||
}
|
||||
g_list_free (pending_tags);
|
||||
}
|
||||
|
||||
if (g_atomic_int_get (&src->priv->have_events)) {
|
||||
GST_OBJECT_LOCK (src);
|
||||
/* take the events */
|
||||
|
|
Loading…
Reference in a new issue