pad: only check event order when something changed

Check the event order in dataflow only when something changed instead
of for each buffer.
This commit is contained in:
Wim Taymans 2013-09-26 11:32:50 +02:00
parent b924900fa2
commit 62b7d17c2e

View file

@ -136,6 +136,7 @@ struct _GstPadPrivate
{
guint events_cookie;
GArray *events;
guint last_cookie;
gint using;
guint probe_list_cookie;
@ -356,6 +357,8 @@ gst_pad_init (GstPad * pad)
g_hook_list_init (&pad->probes, sizeof (GstProbe));
pad->priv->events = g_array_sized_new (FALSE, TRUE, sizeof (PadEvent), 16);
pad->priv->events_cookie = 0;
pad->priv->last_cookie = -1;
}
/* called when setting the pad inactive. It removes all sticky events from
@ -3674,6 +3677,7 @@ gst_pad_chain_data_unchecked (GstPad * pad, GstPadProbeType type, void *data)
goto wrong_mode;
#ifndef G_DISABLE_ASSERT
if (G_UNLIKELY (pad->priv->last_cookie != pad->priv->events_cookie)) {
if (!find_event_by_type (pad, GST_EVENT_STREAM_START, 0)) {
g_warning (G_STRLOC
":%s:<%s:%s> Got data flow before stream-start event",
@ -3684,6 +3688,8 @@ gst_pad_chain_data_unchecked (GstPad * pad, GstPadProbeType type, void *data)
":%s:<%s:%s> Got data flow before segment event",
G_STRFUNC, GST_DEBUG_PAD_NAME (pad));
}
pad->priv->last_cookie = pad->priv->events_cookie;
}
#endif
PROBE_PUSH (pad, type | GST_PAD_PROBE_TYPE_BLOCK, data, probe_stopped);
@ -3905,6 +3911,7 @@ gst_pad_push_data (GstPad * pad, GstPadProbeType type, void *data)
goto wrong_mode;
#ifndef G_DISABLE_ASSERT
if (G_UNLIKELY (pad->priv->last_cookie != pad->priv->events_cookie)) {
if (!find_event_by_type (pad, GST_EVENT_STREAM_START, 0)) {
g_warning (G_STRLOC
":%s:<%s:%s> Got data flow before stream-start event",
@ -3915,6 +3922,8 @@ gst_pad_push_data (GstPad * pad, GstPadProbeType type, void *data)
":%s:<%s:%s> Got data flow before segment event",
G_STRFUNC, GST_DEBUG_PAD_NAME (pad));
}
pad->priv->last_cookie = pad->priv->events_cookie;
}
#endif
if (G_UNLIKELY ((ret = check_sticky (pad, NULL))) != GST_FLOW_OK)