From d08fb9c241ef8c4df4e20d38bf5ba7a396ff1966 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 16 Dec 2024 11:41:40 +0200 Subject: [PATCH] baseparse: Add bitrate tags to empty taglists too It's unclear why empty taglists should be handled in a special way. If the subclass or upstream did not provide any tags at all then we can still provide bitrate tags at least. Part-of: --- .../gstreamer/libs/gst/base/gstbaseparse.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/subprojects/gstreamer/libs/gst/base/gstbaseparse.c b/subprojects/gstreamer/libs/gst/base/gstbaseparse.c index 6b9636dbbb..472f88fcf2 100644 --- a/subprojects/gstreamer/libs/gst/base/gstbaseparse.c +++ b/subprojects/gstreamer/libs/gst/base/gstbaseparse.c @@ -952,16 +952,11 @@ gst_base_parse_queue_tag_event_update (GstBaseParse * parse) GST_DEBUG_OBJECT (parse, "merged : %" GST_PTR_FORMAT, merged_tags); if (merged_tags == NULL) - return; - - if (gst_tag_list_is_empty (merged_tags)) { - gst_tag_list_unref (merged_tags); - return; - } + merged_tags = gst_tag_list_new_empty (); if (parse->priv->framecount >= MIN_FRAMES_TO_POST_BITRATE) { - /* only add bitrate tags to non-empty taglists for now, and only if neither - * upstream tags nor the subclass sets the bitrate tag in question already */ + /* only add bitrate tags if neither upstream tags nor the subclass sets the + * bitrate tag in question already */ if (parse->priv->min_bitrate != G_MAXUINT && parse->priv->post_min_bitrate) { GST_LOG_OBJECT (parse, "adding min bitrate %u", parse->priv->min_bitrate); gst_tag_list_add (merged_tags, GST_TAG_MERGE_KEEP, @@ -980,6 +975,11 @@ gst_base_parse_queue_tag_event_update (GstBaseParse * parse) } } + if (gst_tag_list_is_empty (merged_tags)) { + gst_tag_list_unref (merged_tags); + return; + } + parse->priv->pending_events = g_list_prepend (parse->priv->pending_events, gst_event_new_tag (merged_tags));