mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-01 09:21:03 +00:00
ghostpad: Don't use g_signal_handler_disconnect_by_*
It introduces an unneeded overhead. Instead store the id of the signal handlers and remove them properly
This commit is contained in:
parent
7848b66e3e
commit
184b6e555a
1 changed files with 29 additions and 8 deletions
|
@ -677,6 +677,8 @@ struct _GstGhostPadPrivate
|
||||||
{
|
{
|
||||||
/* with PROXY_LOCK */
|
/* with PROXY_LOCK */
|
||||||
gulong notify_id;
|
gulong notify_id;
|
||||||
|
gulong target_caps_notify_id;
|
||||||
|
gulong target_unlinked_id;
|
||||||
|
|
||||||
gboolean constructed;
|
gboolean constructed;
|
||||||
};
|
};
|
||||||
|
@ -941,10 +943,22 @@ done:
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_src_target_unlinked (GstPad * pad, GstPad * peer, gpointer user_data)
|
on_src_target_unlinked (GstPad * pad, GstPad * peer, GstGhostPad * gpad)
|
||||||
{
|
{
|
||||||
g_signal_handlers_disconnect_by_func (pad,
|
GST_DEBUG_OBJECT (pad, "unlinked");
|
||||||
(gpointer) on_src_target_notify, NULL);
|
GST_DEBUG_OBJECT (gpad, "unlinked");
|
||||||
|
|
||||||
|
if (GST_GHOST_PAD_PRIVATE (gpad)->target_caps_notify_id) {
|
||||||
|
g_signal_handler_disconnect (pad,
|
||||||
|
GST_GHOST_PAD_PRIVATE (gpad)->target_caps_notify_id);
|
||||||
|
GST_GHOST_PAD_PRIVATE (gpad)->target_caps_notify_id = 0;
|
||||||
|
}
|
||||||
|
/* And remove our signal */
|
||||||
|
if (GST_GHOST_PAD_PRIVATE (gpad)->target_unlinked_id) {
|
||||||
|
g_signal_handler_disconnect (pad,
|
||||||
|
GST_GHOST_PAD_PRIVATE (gpad)->target_unlinked_id);
|
||||||
|
GST_GHOST_PAD_PRIVATE (gpad)->target_unlinked_id = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1399,20 +1413,27 @@ gst_ghost_pad_set_target (GstGhostPad * gpad, GstPad * newtarget)
|
||||||
GST_OBJECT_UNLOCK (gpad);
|
GST_OBJECT_UNLOCK (gpad);
|
||||||
|
|
||||||
/* unlink internal pad */
|
/* unlink internal pad */
|
||||||
if (GST_PAD_IS_SRC (internal))
|
if (GST_PAD_IS_SRC (internal)) {
|
||||||
|
GST_DEBUG_OBJECT (gpad, "Unlinking %s:%s from oldtarget %s:%s",
|
||||||
|
GST_DEBUG_PAD_NAME (internal), GST_DEBUG_PAD_NAME (oldtarget));
|
||||||
gst_pad_unlink (internal, oldtarget);
|
gst_pad_unlink (internal, oldtarget);
|
||||||
else
|
} else {
|
||||||
|
GST_DEBUG_OBJECT (gpad, "Unlinking oldtarget %s:%s from internal %s:%s",
|
||||||
|
GST_DEBUG_PAD_NAME (oldtarget), GST_DEBUG_PAD_NAME (internal));
|
||||||
gst_pad_unlink (oldtarget, internal);
|
gst_pad_unlink (oldtarget, internal);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
GST_OBJECT_UNLOCK (gpad);
|
GST_OBJECT_UNLOCK (gpad);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newtarget) {
|
if (newtarget) {
|
||||||
if (GST_PAD_IS_SRC (newtarget)) {
|
if (GST_PAD_IS_SRC (newtarget)) {
|
||||||
|
GST_GHOST_PAD_PRIVATE (gpad)->target_caps_notify_id =
|
||||||
g_signal_connect (newtarget, "notify::caps",
|
g_signal_connect (newtarget, "notify::caps",
|
||||||
G_CALLBACK (on_src_target_notify), NULL);
|
G_CALLBACK (on_src_target_notify), NULL);
|
||||||
|
GST_GHOST_PAD_PRIVATE (gpad)->target_unlinked_id =
|
||||||
g_signal_connect (newtarget, "unlinked",
|
g_signal_connect (newtarget, "unlinked",
|
||||||
G_CALLBACK (on_src_target_unlinked), NULL);
|
G_CALLBACK (on_src_target_unlinked), gpad);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* and link to internal pad without any checks */
|
/* and link to internal pad without any checks */
|
||||||
|
|
Loading…
Reference in a new issue