gstpad: Simplify task name creation

This was going through a few locks and doing temporarily allocations for every
single task creation.. just to get a name.

We don't need to take locks since:
* The parent exists (we have a reference to it)
* The pad exists (the task belongs to it)
* Changing names of pad/elements when activating is a big no-no

Instead use the existing direct GST_DEBUG_PAD_NAME macro

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/455>
This commit is contained in:
Edward Hervey 2020-05-01 17:27:07 +02:00
parent 7a207da733
commit 5e553b8cce

View file

@ -6159,14 +6159,12 @@ do_stream_status (GstPad * pad, GstStreamStatusType type,
GValue value = { 0 };
if (type == GST_STREAM_STATUS_TYPE_ENTER) {
gchar *tname, *ename, *pname;
gchar *tname;
/* create a good task name */
ename = gst_element_get_name (parent);
pname = gst_pad_get_name (pad);
tname = g_strdup_printf ("%s:%s", ename, pname);
g_free (ename);
g_free (pname);
/* create a good task name (we can directly grab the parent and pad
* names since they both exist at this point, and changing the name of
* parent and pad when a pad is activating is a big no-no). */
tname = g_strdup_printf ("%s:%s", GST_DEBUG_PAD_NAME (pad));
gst_object_set_name (GST_OBJECT_CAST (task), tname);
g_free (tname);