From: Kostya Shishkov Date: Sun, 3 Mar 2024 13:59:46 +0000 (+0100) Subject: nihav_itu: ignore high-profile extradata tail when it is not correct X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=e12dabcd04fc59677660fce8fc9437931d141e93;p=nihav.git nihav_itu: ignore high-profile extradata tail when it is not correct --- diff --git a/nihav-itu/src/codecs/h264/decoder_mt.rs b/nihav-itu/src/codecs/h264/decoder_mt.rs index f66ce2f..cdddfec 100644 --- a/nihav-itu/src/codecs/h264/decoder_mt.rs +++ b/nihav-itu/src/codecs/h264/decoder_mt.rs @@ -769,7 +769,10 @@ impl NADecoderMT for H264MTDecoder { match profile { 100 | 110 | 122 | 144 => { let b = br.read_byte()?; - validate!((b & 0xFC) == 0xFC); + // some encoders put something different here + if (b & 0xFC) != 0xFC { + return Ok(()); + } // b & 3 -> chroma format let b = br.read_byte()?; validate!((b & 0xF8) == 0xF8); diff --git a/nihav-itu/src/codecs/h264/decoder_st.rs b/nihav-itu/src/codecs/h264/decoder_st.rs index 94b3977..fad0dd9 100644 --- a/nihav-itu/src/codecs/h264/decoder_st.rs +++ b/nihav-itu/src/codecs/h264/decoder_st.rs @@ -756,7 +756,10 @@ impl NADecoder for H264Decoder { match profile { 100 | 110 | 122 | 144 => { let b = br.read_byte()?; - validate!((b & 0xFC) == 0xFC); + // some encoders put something different here + if (b & 0xFC) != 0xFC { + return Ok(()); + } // b & 3 -> chroma format let b = br.read_byte()?; validate!((b & 0xF8) == 0xF8);