mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-25 15:36:42 +00:00
webrtc: name threads based on the element name
Makes debugging a busy loop possibly easier Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1240>
This commit is contained in:
parent
d0be6b74f2
commit
1f395e3ddb
3 changed files with 42 additions and 16 deletions
|
@ -713,9 +713,13 @@ _gst_pc_thread (GstWebRTCBin * webrtc)
|
||||||
static void
|
static void
|
||||||
_start_thread (GstWebRTCBin * webrtc)
|
_start_thread (GstWebRTCBin * webrtc)
|
||||||
{
|
{
|
||||||
|
gchar *name;
|
||||||
|
|
||||||
PC_LOCK (webrtc);
|
PC_LOCK (webrtc);
|
||||||
webrtc->priv->thread = g_thread_new ("gst-pc-ops",
|
name = g_strdup_printf ("%s:pc", GST_OBJECT_NAME (webrtc));
|
||||||
(GThreadFunc) _gst_pc_thread, webrtc);
|
webrtc->priv->thread = g_thread_new (name, (GThreadFunc) _gst_pc_thread,
|
||||||
|
webrtc);
|
||||||
|
g_free (name);
|
||||||
|
|
||||||
while (!webrtc->priv->loop)
|
while (!webrtc->priv->loop)
|
||||||
PC_COND_WAIT (webrtc);
|
PC_COND_WAIT (webrtc);
|
||||||
|
@ -5840,6 +5844,21 @@ gst_webrtc_bin_get_property (GObject * object, guint prop_id,
|
||||||
PC_UNLOCK (webrtc);
|
PC_UNLOCK (webrtc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_webrtc_bin_constructed (GObject * object)
|
||||||
|
{
|
||||||
|
GstWebRTCBin *webrtc = GST_WEBRTC_BIN (object);
|
||||||
|
gchar *name;
|
||||||
|
|
||||||
|
GST_ERROR_OBJECT (webrtc, "%s", GST_OBJECT_NAME (webrtc));
|
||||||
|
name = g_strdup_printf ("%s:ice", GST_OBJECT_NAME (webrtc));
|
||||||
|
webrtc->priv->ice = gst_webrtc_ice_new (name);
|
||||||
|
g_signal_connect (webrtc->priv->ice, "on-ice-candidate",
|
||||||
|
G_CALLBACK (_on_local_ice_candidate_cb), webrtc);
|
||||||
|
|
||||||
|
g_free (name);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_free_pending_pad (GstPad * pad)
|
_free_pending_pad (GstPad * pad)
|
||||||
{
|
{
|
||||||
|
@ -5957,6 +5976,7 @@ gst_webrtc_bin_class_init (GstWebRTCBinClass * klass)
|
||||||
"Filter/Network/WebRTC", "A bin for webrtc connections",
|
"Filter/Network/WebRTC", "A bin for webrtc connections",
|
||||||
"Matthew Waters <matthew@centricular.com>");
|
"Matthew Waters <matthew@centricular.com>");
|
||||||
|
|
||||||
|
gobject_class->constructed = gst_webrtc_bin_constructed;
|
||||||
gobject_class->get_property = gst_webrtc_bin_get_property;
|
gobject_class->get_property = gst_webrtc_bin_get_property;
|
||||||
gobject_class->set_property = gst_webrtc_bin_set_property;
|
gobject_class->set_property = gst_webrtc_bin_set_property;
|
||||||
gobject_class->dispose = gst_webrtc_bin_dispose;
|
gobject_class->dispose = gst_webrtc_bin_dispose;
|
||||||
|
@ -6395,9 +6415,6 @@ gst_webrtc_bin_init (GstWebRTCBin * webrtc)
|
||||||
g_array_set_clear_func (webrtc->priv->session_mid_map,
|
g_array_set_clear_func (webrtc->priv->session_mid_map,
|
||||||
(GDestroyNotify) clear_session_mid_item);
|
(GDestroyNotify) clear_session_mid_item);
|
||||||
|
|
||||||
webrtc->priv->ice = gst_webrtc_ice_new ();
|
|
||||||
g_signal_connect (webrtc->priv->ice, "on-ice-candidate",
|
|
||||||
G_CALLBACK (_on_local_ice_candidate_cb), webrtc);
|
|
||||||
webrtc->priv->ice_stream_map =
|
webrtc->priv->ice_stream_map =
|
||||||
g_array_new (FALSE, TRUE, sizeof (IceStreamItem));
|
g_array_new (FALSE, TRUE, sizeof (IceStreamItem));
|
||||||
webrtc->priv->pending_remote_ice_candidates =
|
webrtc->priv->pending_remote_ice_candidates =
|
||||||
|
|
|
@ -118,7 +118,7 @@ static void
|
||||||
_start_thread (GstWebRTCICE * ice)
|
_start_thread (GstWebRTCICE * ice)
|
||||||
{
|
{
|
||||||
g_mutex_lock (&ice->priv->lock);
|
g_mutex_lock (&ice->priv->lock);
|
||||||
ice->priv->thread = g_thread_new ("gst-nice-ops",
|
ice->priv->thread = g_thread_new (GST_OBJECT_NAME (ice),
|
||||||
(GThreadFunc) _gst_nice_thread, ice);
|
(GThreadFunc) _gst_nice_thread, ice);
|
||||||
|
|
||||||
while (!ice->priv->loop)
|
while (!ice->priv->loop)
|
||||||
|
@ -901,11 +901,27 @@ gst_webrtc_ice_finalize (GObject * object)
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_webrtc_ice_constructed (GObject * object)
|
||||||
|
{
|
||||||
|
GstWebRTCICE *ice = GST_WEBRTC_ICE (object);
|
||||||
|
|
||||||
|
_start_thread (ice);
|
||||||
|
|
||||||
|
ice->priv->nice_agent = nice_agent_new (ice->priv->main_context,
|
||||||
|
NICE_COMPATIBILITY_RFC5245);
|
||||||
|
g_signal_connect (ice->priv->nice_agent, "new-candidate-full",
|
||||||
|
G_CALLBACK (_on_new_candidate), ice);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (parent_class)->constructed (object);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_webrtc_ice_class_init (GstWebRTCICEClass * klass)
|
gst_webrtc_ice_class_init (GstWebRTCICEClass * klass)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class = (GObjectClass *) klass;
|
GObjectClass *gobject_class = (GObjectClass *) klass;
|
||||||
|
|
||||||
|
gobject_class->constructed = gst_webrtc_ice_constructed;
|
||||||
gobject_class->get_property = gst_webrtc_ice_get_property;
|
gobject_class->get_property = gst_webrtc_ice_get_property;
|
||||||
gobject_class->set_property = gst_webrtc_ice_set_property;
|
gobject_class->set_property = gst_webrtc_ice_set_property;
|
||||||
gobject_class->finalize = gst_webrtc_ice_finalize;
|
gobject_class->finalize = gst_webrtc_ice_finalize;
|
||||||
|
@ -964,13 +980,6 @@ gst_webrtc_ice_init (GstWebRTCICE * ice)
|
||||||
g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
|
g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
|
||||||
(GDestroyNotify) gst_uri_unref);
|
(GDestroyNotify) gst_uri_unref);
|
||||||
|
|
||||||
_start_thread (ice);
|
|
||||||
|
|
||||||
ice->priv->nice_agent = nice_agent_new (ice->priv->main_context,
|
|
||||||
NICE_COMPATIBILITY_RFC5245);
|
|
||||||
g_signal_connect (ice->priv->nice_agent, "new-candidate-full",
|
|
||||||
G_CALLBACK (_on_new_candidate), ice);
|
|
||||||
|
|
||||||
ice->priv->nice_stream_map =
|
ice->priv->nice_stream_map =
|
||||||
g_array_new (FALSE, TRUE, sizeof (struct NiceStreamItem));
|
g_array_new (FALSE, TRUE, sizeof (struct NiceStreamItem));
|
||||||
g_array_set_clear_func (ice->priv->nice_stream_map,
|
g_array_set_clear_func (ice->priv->nice_stream_map,
|
||||||
|
@ -978,7 +987,7 @@ gst_webrtc_ice_init (GstWebRTCICE * ice)
|
||||||
}
|
}
|
||||||
|
|
||||||
GstWebRTCICE *
|
GstWebRTCICE *
|
||||||
gst_webrtc_ice_new (void)
|
gst_webrtc_ice_new (const gchar * name)
|
||||||
{
|
{
|
||||||
return g_object_new (GST_TYPE_WEBRTC_ICE, NULL);
|
return g_object_new (GST_TYPE_WEBRTC_ICE, "name", name, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ struct _GstWebRTCICEClass
|
||||||
GstObjectClass parent_class;
|
GstObjectClass parent_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
GstWebRTCICE * gst_webrtc_ice_new (void);
|
GstWebRTCICE * gst_webrtc_ice_new (const gchar * name);
|
||||||
GstWebRTCICEStream * gst_webrtc_ice_add_stream (GstWebRTCICE * ice,
|
GstWebRTCICEStream * gst_webrtc_ice_add_stream (GstWebRTCICE * ice,
|
||||||
guint session_id);
|
guint session_id);
|
||||||
GstWebRTCICETransport * gst_webrtc_ice_find_transport (GstWebRTCICE * ice,
|
GstWebRTCICETransport * gst_webrtc_ice_find_transport (GstWebRTCICE * ice,
|
||||||
|
|
Loading…
Reference in a new issue