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:
Wim Taymans 2010-12-03 10:52:39 +01:00
parent 2239038d76
commit d3630379da
3 changed files with 17 additions and 11 deletions

View file

@ -48,6 +48,9 @@ extern const char g_log_domain_gstreamer[];
/* for the flags in the GstPluginDep structure below */
#include "gstplugin.h"
/* for the pad cache */
#include "gstpad.h"
G_BEGIN_DECLS
/* 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);
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 */
#define STRUCTURE_ESTIMATED_STRING_LEN(s) (16 + (s)->fields->len * 22)

View file

@ -108,8 +108,6 @@ static GstPadPushCache _pad_cache_invalid = { NULL, };
#define PAD_CACHE_INVALID (&_pad_cache_invalid)
static void pad_invalidate_cache (GstPad * pad);
#define GST_PAD_GET_PRIVATE(obj) \
(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:
GST_OBJECT_LOCK (pad);
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_ACTIVATE_MODE (pad) = new_mode;
/* unlock blocked pads so element can resume and stop */
@ -875,7 +873,7 @@ failure:
GST_OBJECT_LOCK (pad);
GST_CAT_INFO_OBJECT (GST_CAT_PADS, pad, "failed to %s in pull mode",
active ? "activate" : "deactivate");
pad_invalidate_cache (pad);
_priv_gst_pad_invalidate_cache (pad);
GST_PAD_SET_FLUSHING (pad);
GST_PAD_ACTIVATE_MODE (pad) = old;
GST_OBJECT_UNLOCK (pad);
@ -981,7 +979,7 @@ failure:
GST_OBJECT_LOCK (pad);
GST_CAT_INFO_OBJECT (GST_CAT_PADS, pad, "failed to %s in push mode",
active ? "activate" : "deactivate");
pad_invalidate_cache (pad);
_priv_gst_pad_invalidate_cache (pad);
GST_PAD_SET_FLUSHING (pad);
GST_PAD_ACTIVATE_MODE (pad) = old;
GST_OBJECT_UNLOCK (pad);
@ -1059,7 +1057,7 @@ gst_pad_set_blocked_async_full (GstPad * pad, gboolean blocked,
if (blocked) {
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);
if (pad->block_destroy_data && pad->block_data)
@ -1738,7 +1736,7 @@ gst_pad_unlink (GstPad * srcpad, GstPad * sinkpad)
GST_PAD_UNLINKFUNC (sinkpad) (sinkpad);
}
pad_invalidate_cache (srcpad);
_priv_gst_pad_invalidate_cache (srcpad);
/* first clear peers */
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 */
static void
pad_invalidate_cache (GstPad * pad)
void
_priv_gst_pad_invalidate_cache (GstPad * pad)
{
GstPadPushCache *cache;
gpointer *cache_ptr;
@ -5082,7 +5080,7 @@ gst_pad_push_event (GstPad * pad, GstEvent * event)
* . handle pad blocking */
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_FLUSH_START:
pad_invalidate_cache (pad);
_priv_gst_pad_invalidate_cache (pad);
GST_PAD_SET_FLUSHING (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))
goto flushing;
pad_invalidate_cache (pad);
_priv_gst_pad_invalidate_cache (pad);
GST_PAD_SET_FLUSHING (pad);
GST_CAT_DEBUG_OBJECT (GST_CAT_EVENT, pad, "set flush flag");
break;

View file

@ -3234,6 +3234,7 @@ gst_pad_add_data_probe_full (GstPad * pad, GCallback handler,
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad,
"adding data probe, now %d data, %d event probes",
GST_PAD_DO_BUFFER_SIGNALS (pad), GST_PAD_DO_EVENT_SIGNALS (pad));
_priv_gst_pad_invalidate_cache (pad);
GST_OBJECT_UNLOCK (pad);
return sigid;
@ -3291,6 +3292,7 @@ gst_pad_add_event_probe_full (GstPad * pad, GCallback handler,
GST_PAD_DO_EVENT_SIGNALS (pad)++;
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "adding event probe, now %d probes",
GST_PAD_DO_EVENT_SIGNALS (pad));
_priv_gst_pad_invalidate_cache (pad);
GST_OBJECT_UNLOCK (pad);
return sigid;
@ -3348,6 +3350,7 @@ gst_pad_add_buffer_probe_full (GstPad * pad, GCallback handler,
GST_PAD_DO_BUFFER_SIGNALS (pad)++;
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "adding buffer probe, now %d probes",
GST_PAD_DO_BUFFER_SIGNALS (pad));
_priv_gst_pad_invalidate_cache (pad);
GST_OBJECT_UNLOCK (pad);
return sigid;