]> git.nihav.org Git - nihav.git/commitdiff
nihav_itu: ignore high-profile extradata tail when it is not correct
authorKostya Shishkov <kostya.shishkov@gmail.com>
Sun, 3 Mar 2024 13:59:46 +0000 (14:59 +0100)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Sun, 3 Mar 2024 13:59:46 +0000 (14:59 +0100)
nihav-itu/src/codecs/h264/decoder_mt.rs
nihav-itu/src/codecs/h264/decoder_st.rs

index f66ce2f89cf7e2882bd53c3668d188b253c41e2e..cdddfecb8f26213b04fa634945197e63e825d7cc 100644 (file)
@@ -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);
index 94b3977c0622d3c046219fba2844f53b97e92f3e..fad0dd9ac539a9276b74fa65382e79e7a050fe27 100644 (file)
@@ -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);