From 8081c22a73a1b613d0a995f576a76f50c17b3c2a Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Wed, 21 Jun 2023 13:44:40 +0200 Subject: [PATCH] streamcollection: Use upstream-id as name It is more coherent, in the same vein as 08dc5d29 Fixes #2640 Part-of: --- .../flow-expectations/log-i-sink-expected | 2 +- .../log-testsrcbin0-video_src_0-expected | 2 +- subprojects/gstreamer/gst/gststreamcollection.c | 10 ++++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/subprojects/gst-integration-testsuites/testsuites/validate/dash/seek_with_stop_between_fragments/flow-expectations/log-i-sink-expected b/subprojects/gst-integration-testsuites/testsuites/validate/dash/seek_with_stop_between_fragments/flow-expectations/log-i-sink-expected index 75b53a14cd..4948d69d2c 100644 --- a/subprojects/gst-integration-testsuites/testsuites/validate/dash/seek_with_stop_between_fragments/flow-expectations/log-i-sink-expected +++ b/subprojects/gst-integration-testsuites/testsuites/validate/dash/seek_with_stop_between_fragments/flow-expectations/log-i-sink-expected @@ -1,7 +1,7 @@ event stream-start: GstEventStreamStart, flags=(GstStreamFlags)GST_STREAM_FLAG_NONE, group-id=(uint)1, stream=(GstStream)"\(GstStream\)\ ecf1ea12b198caea123f05f4fcb08daa35ee5045577d2be98f3424c0ce90757a/video-0"; event caps: video/x-raw, colorimetry=(string)2:4:0:0, format=(string)I420, framerate=(fraction)0/1, height=(int)446, interlace-mode=(string)progressive, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, width=(int)928; event segment: format=TIME, start=0:00:00.000000000, offset=0:00:00.000000000, stop=none, time=0:00:00.000000000, base=0:00:00.000000000, position=0:00:00.000000000 -event stream-collection: stream-collection, collection=(GstStreamCollection)"\(GstStreamCollection\)\ streamcollection0"; +event stream-collection: stream-collection, collection=(GstStreamCollection)"\(GstStreamCollection\)\ adaptivedemux"; buffer: content-id=0, pts=0:00:00.014000000, flags=discont, meta=GstVideoMeta event flush-start: (no structure) event flush-stop: GstEventFlushStop, reset-time=(boolean)true; diff --git a/subprojects/gst-plugins-bad/tests/validate/testsrcbin/caps_spec/flow-expectations/log-testsrcbin0-video_src_0-expected b/subprojects/gst-plugins-bad/tests/validate/testsrcbin/caps_spec/flow-expectations/log-testsrcbin0-video_src_0-expected index 66f82c1383..849c517c42 100644 --- a/subprojects/gst-plugins-bad/tests/validate/testsrcbin/caps_spec/flow-expectations/log-testsrcbin0-video_src_0-expected +++ b/subprojects/gst-plugins-bad/tests/validate/testsrcbin/caps_spec/flow-expectations/log-testsrcbin0-video_src_0-expected @@ -1,5 +1,5 @@ event stream-start: GstEventStreamStart, flags=(GstStreamFlags)GST_STREAM_FLAG_NONE, group-id=(uint)1, stream=(GstStream)"\(GstStream\)\ videotestsrc_stream_0"; event caps: video/x-raw, format=(string)ABGR64_LE, framerate=(fraction)30/1, height=(int)1080, interlace-mode=(string)progressive, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, width=(int)1920; -event stream-collection: stream-collection, collection=(GstStreamCollection)"\(GstStreamCollection\)\ streamcollection0"; +event stream-collection: stream-collection, collection=(GstStreamCollection)"\(GstStreamCollection\)\ unparented"; event segment: format=TIME, start=0:00:00.000000000, offset=0:00:00.000000000, stop=none, time=0:00:00.000000000, base=0:00:00.000000000, position=0:00:00.000000000 event eos: (no structure) diff --git a/subprojects/gstreamer/gst/gststreamcollection.c b/subprojects/gstreamer/gst/gststreamcollection.c index 6ec79359b1..4d3d46cfd1 100644 --- a/subprojects/gstreamer/gst/gststreamcollection.c +++ b/subprojects/gstreamer/gst/gststreamcollection.c @@ -189,6 +189,7 @@ gst_stream_collection_set_upstream_id (GstStreamCollection * collection, { g_return_if_fail (collection->upstream_id == NULL); + GST_OBJECT_LOCK (collection); /* Upstream ID should only be set once on construction, but let's * not leak in case someone does something silly */ if (collection->upstream_id) @@ -196,6 +197,15 @@ gst_stream_collection_set_upstream_id (GstStreamCollection * collection, if (upstream_id) collection->upstream_id = g_strdup (upstream_id); + + /* We hold the object lock, replace directly */ + g_free (GST_OBJECT_NAME (collection)); + if (upstream_id) + GST_OBJECT_NAME (collection) = g_strdup (upstream_id); + else + GST_OBJECT_NAME (collection) = g_strdup ("unparented"); + + GST_OBJECT_UNLOCK (collection); } /**