mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-22 05:56:31 +00:00
pad: invalidate caches on flush and pad block
This commit is contained in:
parent
8abc14052a
commit
5e37ade932
1 changed files with 17 additions and 0 deletions
17
gst/gstpad.c
17
gst/gstpad.c
|
@ -635,6 +635,7 @@ pre_activate (GstPad * pad, GstActivateMode new_mode)
|
||||||
case GST_ACTIVATE_NONE:
|
case GST_ACTIVATE_NONE:
|
||||||
GST_OBJECT_LOCK (pad);
|
GST_OBJECT_LOCK (pad);
|
||||||
GST_DEBUG_OBJECT (pad, "setting ACTIVATE_MODE NONE, set flushing");
|
GST_DEBUG_OBJECT (pad, "setting ACTIVATE_MODE NONE, set flushing");
|
||||||
|
pad_invalidate_cache (pad);
|
||||||
GST_PAD_SET_FLUSHING (pad);
|
GST_PAD_SET_FLUSHING (pad);
|
||||||
GST_PAD_ACTIVATE_MODE (pad) = new_mode;
|
GST_PAD_ACTIVATE_MODE (pad) = new_mode;
|
||||||
/* unlock blocked pads so element can resume and stop */
|
/* unlock blocked pads so element can resume and stop */
|
||||||
|
@ -875,6 +876,7 @@ failure:
|
||||||
GST_OBJECT_LOCK (pad);
|
GST_OBJECT_LOCK (pad);
|
||||||
GST_CAT_INFO_OBJECT (GST_CAT_PADS, pad, "failed to %s in pull mode",
|
GST_CAT_INFO_OBJECT (GST_CAT_PADS, pad, "failed to %s in pull mode",
|
||||||
active ? "activate" : "deactivate");
|
active ? "activate" : "deactivate");
|
||||||
|
pad_invalidate_cache (pad);
|
||||||
GST_PAD_SET_FLUSHING (pad);
|
GST_PAD_SET_FLUSHING (pad);
|
||||||
GST_PAD_ACTIVATE_MODE (pad) = old;
|
GST_PAD_ACTIVATE_MODE (pad) = old;
|
||||||
GST_OBJECT_UNLOCK (pad);
|
GST_OBJECT_UNLOCK (pad);
|
||||||
|
@ -980,6 +982,7 @@ failure:
|
||||||
GST_OBJECT_LOCK (pad);
|
GST_OBJECT_LOCK (pad);
|
||||||
GST_CAT_INFO_OBJECT (GST_CAT_PADS, pad, "failed to %s in push mode",
|
GST_CAT_INFO_OBJECT (GST_CAT_PADS, pad, "failed to %s in push mode",
|
||||||
active ? "activate" : "deactivate");
|
active ? "activate" : "deactivate");
|
||||||
|
pad_invalidate_cache (pad);
|
||||||
GST_PAD_SET_FLUSHING (pad);
|
GST_PAD_SET_FLUSHING (pad);
|
||||||
GST_PAD_ACTIVATE_MODE (pad) = old;
|
GST_PAD_ACTIVATE_MODE (pad) = old;
|
||||||
GST_OBJECT_UNLOCK (pad);
|
GST_OBJECT_UNLOCK (pad);
|
||||||
|
@ -1057,6 +1060,7 @@ gst_pad_set_blocked_async_full (GstPad * pad, gboolean blocked,
|
||||||
if (blocked) {
|
if (blocked) {
|
||||||
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad, "blocking pad");
|
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad, "blocking pad");
|
||||||
|
|
||||||
|
pad_invalidate_cache (pad);
|
||||||
GST_OBJECT_FLAG_SET (pad, GST_PAD_BLOCKED);
|
GST_OBJECT_FLAG_SET (pad, GST_PAD_BLOCKED);
|
||||||
|
|
||||||
if (pad->block_destroy_data && pad->block_data)
|
if (pad->block_destroy_data && pad->block_data)
|
||||||
|
@ -4557,12 +4561,22 @@ pad_put_cache (GstPad * pad, GstPadPushCache * cache, gpointer * cache_ptr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* must be called with the pad lock */
|
||||||
static void
|
static void
|
||||||
pad_invalidate_cache (GstPad * pad)
|
pad_invalidate_cache (GstPad * pad)
|
||||||
{
|
{
|
||||||
GstPadPushCache *cache;
|
GstPadPushCache *cache;
|
||||||
gpointer *cache_ptr;
|
gpointer *cache_ptr;
|
||||||
|
|
||||||
|
GST_LOG_OBJECT (pad, "Invalidating pad cache");
|
||||||
|
|
||||||
|
/* we hold the pad lock here so we can get the peer and it stays
|
||||||
|
* alive during this call */
|
||||||
|
if (GST_PAD_IS_SINK (pad)) {
|
||||||
|
if (!(pad = GST_PAD_PEER (pad)))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
cache_ptr = (gpointer *) & pad->abidata.ABI.priv->cache_ptr;
|
cache_ptr = (gpointer *) & pad->abidata.ABI.priv->cache_ptr;
|
||||||
|
|
||||||
/* try to get the cached data */
|
/* try to get the cached data */
|
||||||
|
@ -5069,6 +5083,7 @@ gst_pad_push_event (GstPad * pad, GstEvent * event)
|
||||||
* . handle pad blocking */
|
* . handle pad blocking */
|
||||||
switch (GST_EVENT_TYPE (event)) {
|
switch (GST_EVENT_TYPE (event)) {
|
||||||
case GST_EVENT_FLUSH_START:
|
case GST_EVENT_FLUSH_START:
|
||||||
|
pad_invalidate_cache (pad);
|
||||||
GST_PAD_SET_FLUSHING (pad);
|
GST_PAD_SET_FLUSHING (pad);
|
||||||
|
|
||||||
if (G_UNLIKELY (GST_PAD_IS_BLOCKED (pad))) {
|
if (G_UNLIKELY (GST_PAD_IS_BLOCKED (pad))) {
|
||||||
|
@ -5228,6 +5243,8 @@ gst_pad_send_event (GstPad * pad, GstEvent * event)
|
||||||
/* can't even accept a flush begin event when flushing */
|
/* can't even accept a flush begin event when flushing */
|
||||||
if (GST_PAD_IS_FLUSHING (pad))
|
if (GST_PAD_IS_FLUSHING (pad))
|
||||||
goto flushing;
|
goto flushing;
|
||||||
|
|
||||||
|
pad_invalidate_cache (pad);
|
||||||
GST_PAD_SET_FLUSHING (pad);
|
GST_PAD_SET_FLUSHING (pad);
|
||||||
GST_CAT_DEBUG_OBJECT (GST_CAT_EVENT, pad, "set flush flag");
|
GST_CAT_DEBUG_OBJECT (GST_CAT_EVENT, pad, "set flush flag");
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue