From b80cd503b62ad6a0d9b28c02d96299d15bc33d0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Tue, 14 Dec 2021 19:56:48 +0100 Subject: [PATCH] h265parser: Compare upstream profile with in SPS. Compare if upstream profile in caps is the same as the one parsed in the SPS. If they are different use the bigger for simplicity and more chances to decode it. Part-of: --- .../gst/videoparsers/gsth265parse.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/subprojects/gst-plugins-bad/gst/videoparsers/gsth265parse.c b/subprojects/gst-plugins-bad/gst/videoparsers/gsth265parse.c index 2122e81bbb..2eb902d546 100644 --- a/subprojects/gst-plugins-bad/gst/videoparsers/gsth265parse.c +++ b/subprojects/gst-plugins-bad/gst/videoparsers/gsth265parse.c @@ -2356,8 +2356,24 @@ gst_h265_parse_update_src_caps (GstH265Parse * h265parse, GstCaps * caps) GstH265Profile p; p = gst_h265_get_profile_from_sps (sps); - profile = gst_h265_profile_to_string (p); + + if (s && gst_structure_has_field (s, "profile")) { + const gchar *profile_sink = gst_structure_get_string (s, "profile"); + GstH265Profile p_sink = gst_h265_profile_from_string (profile_sink); + + if (p != p_sink) { + const gchar *profile_src; + + p = MAX (p, p_sink); + profile_src = (p == p_sink) ? profile_sink : profile; + GST_INFO_OBJECT (h265parse, + "Upstream profile (%s) is different than in SPS (%s). " + "Using %s.", profile_sink, profile, profile_src); + profile = profile_src; + } + } + if (profile != NULL) gst_caps_set_simple (caps, "profile", G_TYPE_STRING, profile, NULL);