From 364a2fe08e104b66c5d07a842d0c578ba9e17c72 Mon Sep 17 00:00:00 2001 From: He Junyan Date: Fri, 23 Jul 2021 23:38:22 +0800 Subject: va: h264dec: Try to use ConstrainedBaseline or Main to decode BaseLine. In the h264, the Baseline profile is widely misused. A lot of streams declare that they are the Baseline, but in fact they just conform to ConstrainedBaseline. The features such as FMO and ASO are not used at all. If the decoder does not strictly conforms to the SPEC, we can just use Baseline or Main profile to decode it to avoid lots of streams failure. Part-of: --- sys/va/gstvah264dec.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/va/gstvah264dec.c b/sys/va/gstvah264dec.c index 4d342a880..aba8bab70 100644 --- a/sys/va/gstvah264dec.c +++ b/sys/va/gstvah264dec.c @@ -602,13 +602,21 @@ _get_profile (GstVaH264Dec * self, const GstH264SPS * sps, gint max_dpb_size) switch (sps->profile_idc) { case GST_H264_PROFILE_BASELINE: - /* A.2 compliant */ + { + GstH264DecoderCompliance compliance = GST_H264_DECODER_COMPLIANCE_STRICT; + + g_object_get (G_OBJECT (self), "compliance", &compliance, NULL); + + /* A.2 compliant or not strict */ if (sps->constraint_set0_flag || sps->constraint_set1_flag - || sps->constraint_set2_flag) { + || sps->constraint_set2_flag + || compliance != GST_H264_DECODER_COMPLIANCE_STRICT) { profiles[i++] = VAProfileH264ConstrainedBaseline; profiles[i++] = VAProfileH264Main; } + break; + } case GST_H264_PROFILE_EXTENDED: if (sps->constraint_set1_flag) { /* A.2.2 (main profile) */ profiles[i++] = VAProfileH264Main; -- cgit v1.2.1