summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorHe Junyan <junyan.he@intel.com>2021-06-27 15:34:28 +0800
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2021-07-02 10:27:41 +0000
commit8ba730a5644a2db250ef8373a6c09d48a1c07f35 (patch)
tree87539ee55420ca8a96a52972542d769eabf58d86 /gst
parent42a861fe591613313dc6bd6b9c3e0a660d637fb3 (diff)
downloadgstreamer-plugins-bad-8ba730a5644a2db250ef8373a6c09d48a1c07f35.tar.gz
h265parse: Add special profile case for profile_idc 0.
This is a work-around to identify some main profile streams having wrong profile_idc. There are some wrongly encoded main profile streams which doesn't have any of the profile_idc values mentioned in Annex-A, instead, general_profile_idc has been set as zero and the general_profile_compatibility_flag[general_profile_idc] is TRUE. Assuming them as MAIN profile for now. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2322>
Diffstat (limited to 'gst')
-rw-r--r--gst/videoparsers/gsth265parse.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gst/videoparsers/gsth265parse.c b/gst/videoparsers/gsth265parse.c
index fc6023f1a..2122e81bb 100644
--- a/gst/videoparsers/gsth265parse.c
+++ b/gst/videoparsers/gsth265parse.c
@@ -1982,6 +1982,22 @@ get_compatible_profile_caps (GstH265SPS * sps, GstH265Profile profile)
return caps;
}
+static void
+fix_invalid_profile (GstH265Parse * h265parse, GstCaps * caps, GstH265SPS * sps)
+{
+ /* HACK: This is a work-around to identify some main profile streams
+ * having wrong profile_idc. There are some wrongly encoded main profile
+ * streams which doesn't have any of the profile_idc values mentioned in
+ * Annex-A. Just assuming them as MAIN profile for now if they meet the
+ * A.3.2 requirement. */
+ if (sps->chroma_format_idc == 1 && sps->bit_depth_luma_minus8 == 0 &&
+ sps->bit_depth_chroma_minus8 == 0 && sps->sps_extension_flag == 0) {
+ gst_caps_set_simple (caps, "profile", G_TYPE_STRING, "main", NULL);
+ GST_WARNING_OBJECT (h265parse,
+ "Wrong profile_idc = 0, setting it as main profile !!");
+ }
+}
+
/* if downstream didn't support the exact profile indicated in sps header,
* check for the compatible profiles also */
static void
@@ -1990,6 +2006,9 @@ ensure_caps_profile (GstH265Parse * h265parse, GstCaps * caps, GstH265SPS * sps,
{
GstCaps *peer_caps, *compat_caps;
+ if (profile == GST_H265_PROFILE_INVALID)
+ fix_invalid_profile (h265parse, caps, sps);
+
peer_caps = gst_pad_get_current_caps (GST_BASE_PARSE_SRC_PAD (h265parse));
if (!peer_caps || !gst_caps_can_intersect (caps, peer_caps)) {
GstCaps *filter_caps = gst_caps_new_empty_simple ("video/x-h265");