summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilippe Normand <philn@igalia.com>2021-09-12 10:07:49 +0100
committerPhilippe Normand <philn@igalia.com>2021-09-12 10:20:05 +0100
commita55dafe341ac7398e7c37c30d8b760228296da92 (patch)
treefe4cf74ef22e00b686be25411c7e8329e4fb4d0a
parentf6aea043f93729db41187e19574bb1d1b96587db (diff)
downloadgstreamer-plugins-base-a55dafe341ac7398e7c37c30d8b760228296da92.tar.gz
discoverer: Prevent stream tags from leaking in global tags
The PrivateStream should keep track of stream tags only. Likewise, the GstDiscovererInfo should keep track of global tags only. This patch fixes the issue where the discoverer would report duplicated tag titles, especially for Matroska media files. The Matroska demuxer emits correctly-scoped tags, but downstream was making no distinction of them. Fixes #598, #836, https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/827 Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1275>
-rw-r--r--gst-libs/gst/pbutils/gstdiscoverer.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/gst-libs/gst/pbutils/gstdiscoverer.c b/gst-libs/gst/pbutils/gstdiscoverer.c
index 6d175316c..685bb279e 100644
--- a/gst-libs/gst/pbutils/gstdiscoverer.c
+++ b/gst-libs/gst/pbutils/gstdiscoverer.c
@@ -539,9 +539,17 @@ _event_probe (GstPad * pad, GstPadProbeInfo * info, PrivateStream * ps)
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_TAG:{
GstTagList *tl = NULL, *tmp;
+ GstTagScope scope;
gst_event_parse_tag (event, &tl);
+ scope = gst_tag_list_get_scope (tl);
GST_DEBUG_OBJECT (pad, "tags %" GST_PTR_FORMAT, tl);
+
+ if (scope != GST_TAG_SCOPE_STREAM) {
+ GST_DEBUG_OBJECT (pad, "Ignoring non-stream tags");
+ break;
+ }
+
DISCO_LOCK (ps->dc);
/* If preroll is complete, drop these tags - the collected information is
* possibly already being processed and adding more tags would be racy */
@@ -1703,10 +1711,19 @@ handle_message (GstDiscoverer * dc, GstMessage * msg)
case GST_MESSAGE_TAG:
{
- GstTagList *tl, *tmp;
+ GstTagList *tl, *tmp = NULL;
+ GstTagScope scope;
gst_message_parse_tag (msg, &tl);
+ scope = gst_tag_list_get_scope (tl);
GST_DEBUG_OBJECT (GST_MESSAGE_SRC (msg), "Got tags %" GST_PTR_FORMAT, tl);
+
+ if (scope != GST_TAG_SCOPE_GLOBAL) {
+ GST_DEBUG_OBJECT (GST_MESSAGE_SRC (msg), "Ignoring non-global tags");
+ gst_tag_list_unref (tl);
+ break;
+ }
+
/* Merge with current tags */
tmp =
gst_tag_list_merge (dc->priv->current_info->tags, tl,