mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-04 07:26:33 +00:00
pad: clear pad cache when installing probes
Move the method to clear the pad cache into _private.h Clear the pad cache when installing pad probes.
This commit is contained in:
parent
2239038d76
commit
d3630379da
3 changed files with 17 additions and 11 deletions
|
@ -48,6 +48,9 @@ extern const char g_log_domain_gstreamer[];
|
||||||
/* for the flags in the GstPluginDep structure below */
|
/* for the flags in the GstPluginDep structure below */
|
||||||
#include "gstplugin.h"
|
#include "gstplugin.h"
|
||||||
|
|
||||||
|
/* for the pad cache */
|
||||||
|
#include "gstpad.h"
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
/* used by gstparse.c and grammar.y */
|
/* used by gstparse.c and grammar.y */
|
||||||
|
@ -108,6 +111,8 @@ gboolean _priv_gst_registry_remove_cache_plugins (GstRegistry *registry);
|
||||||
void _priv_gst_registry_cleanup (void);
|
void _priv_gst_registry_cleanup (void);
|
||||||
gboolean _gst_plugin_loader_client_run (void);
|
gboolean _gst_plugin_loader_client_run (void);
|
||||||
|
|
||||||
|
void _priv_gst_pad_invalidate_cache (GstPad *pad);
|
||||||
|
|
||||||
/* used in both gststructure.c and gstcaps.c; numbers are completely made up */
|
/* used in both gststructure.c and gstcaps.c; numbers are completely made up */
|
||||||
#define STRUCTURE_ESTIMATED_STRING_LEN(s) (16 + (s)->fields->len * 22)
|
#define STRUCTURE_ESTIMATED_STRING_LEN(s) (16 + (s)->fields->len * 22)
|
||||||
|
|
||||||
|
|
20
gst/gstpad.c
20
gst/gstpad.c
|
@ -108,8 +108,6 @@ static GstPadPushCache _pad_cache_invalid = { NULL, };
|
||||||
|
|
||||||
#define PAD_CACHE_INVALID (&_pad_cache_invalid)
|
#define PAD_CACHE_INVALID (&_pad_cache_invalid)
|
||||||
|
|
||||||
static void pad_invalidate_cache (GstPad * pad);
|
|
||||||
|
|
||||||
#define GST_PAD_GET_PRIVATE(obj) \
|
#define GST_PAD_GET_PRIVATE(obj) \
|
||||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_PAD, GstPadPrivate))
|
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_PAD, GstPadPrivate))
|
||||||
|
|
||||||
|
@ -634,7 +632,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);
|
_priv_gst_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,7 +873,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);
|
_priv_gst_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);
|
||||||
|
@ -981,7 +979,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);
|
_priv_gst_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);
|
||||||
|
@ -1059,7 +1057,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);
|
_priv_gst_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)
|
||||||
|
@ -1738,7 +1736,7 @@ gst_pad_unlink (GstPad * srcpad, GstPad * sinkpad)
|
||||||
GST_PAD_UNLINKFUNC (sinkpad) (sinkpad);
|
GST_PAD_UNLINKFUNC (sinkpad) (sinkpad);
|
||||||
}
|
}
|
||||||
|
|
||||||
pad_invalidate_cache (srcpad);
|
_priv_gst_pad_invalidate_cache (srcpad);
|
||||||
|
|
||||||
/* first clear peers */
|
/* first clear peers */
|
||||||
GST_PAD_PEER (srcpad) = NULL;
|
GST_PAD_PEER (srcpad) = NULL;
|
||||||
|
@ -4561,8 +4559,8 @@ pad_put_cache (GstPad * pad, GstPadPushCache * cache, gpointer * cache_ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* must be called with the pad lock */
|
/* must be called with the pad lock */
|
||||||
static void
|
void
|
||||||
pad_invalidate_cache (GstPad * pad)
|
_priv_gst_pad_invalidate_cache (GstPad * pad)
|
||||||
{
|
{
|
||||||
GstPadPushCache *cache;
|
GstPadPushCache *cache;
|
||||||
gpointer *cache_ptr;
|
gpointer *cache_ptr;
|
||||||
|
@ -5082,7 +5080,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);
|
_priv_gst_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))) {
|
||||||
|
@ -5243,7 +5241,7 @@ gst_pad_send_event (GstPad * pad, GstEvent * event)
|
||||||
if (GST_PAD_IS_FLUSHING (pad))
|
if (GST_PAD_IS_FLUSHING (pad))
|
||||||
goto flushing;
|
goto flushing;
|
||||||
|
|
||||||
pad_invalidate_cache (pad);
|
_priv_gst_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;
|
||||||
|
|
|
@ -3234,6 +3234,7 @@ gst_pad_add_data_probe_full (GstPad * pad, GCallback handler,
|
||||||
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad,
|
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad,
|
||||||
"adding data probe, now %d data, %d event probes",
|
"adding data probe, now %d data, %d event probes",
|
||||||
GST_PAD_DO_BUFFER_SIGNALS (pad), GST_PAD_DO_EVENT_SIGNALS (pad));
|
GST_PAD_DO_BUFFER_SIGNALS (pad), GST_PAD_DO_EVENT_SIGNALS (pad));
|
||||||
|
_priv_gst_pad_invalidate_cache (pad);
|
||||||
GST_OBJECT_UNLOCK (pad);
|
GST_OBJECT_UNLOCK (pad);
|
||||||
|
|
||||||
return sigid;
|
return sigid;
|
||||||
|
@ -3291,6 +3292,7 @@ gst_pad_add_event_probe_full (GstPad * pad, GCallback handler,
|
||||||
GST_PAD_DO_EVENT_SIGNALS (pad)++;
|
GST_PAD_DO_EVENT_SIGNALS (pad)++;
|
||||||
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "adding event probe, now %d probes",
|
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "adding event probe, now %d probes",
|
||||||
GST_PAD_DO_EVENT_SIGNALS (pad));
|
GST_PAD_DO_EVENT_SIGNALS (pad));
|
||||||
|
_priv_gst_pad_invalidate_cache (pad);
|
||||||
GST_OBJECT_UNLOCK (pad);
|
GST_OBJECT_UNLOCK (pad);
|
||||||
|
|
||||||
return sigid;
|
return sigid;
|
||||||
|
@ -3348,6 +3350,7 @@ gst_pad_add_buffer_probe_full (GstPad * pad, GCallback handler,
|
||||||
GST_PAD_DO_BUFFER_SIGNALS (pad)++;
|
GST_PAD_DO_BUFFER_SIGNALS (pad)++;
|
||||||
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "adding buffer probe, now %d probes",
|
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "adding buffer probe, now %d probes",
|
||||||
GST_PAD_DO_BUFFER_SIGNALS (pad));
|
GST_PAD_DO_BUFFER_SIGNALS (pad));
|
||||||
|
_priv_gst_pad_invalidate_cache (pad);
|
||||||
GST_OBJECT_UNLOCK (pad);
|
GST_OBJECT_UNLOCK (pad);
|
||||||
|
|
||||||
return sigid;
|
return sigid;
|
||||||
|
|
Loading…
Reference in a new issue