aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2024-03-03 14:59:46 +0100
committerKostya Shishkov <kostya.shishkov@gmail.com>2024-03-03 14:59:46 +0100
commite12dabcd04fc59677660fce8fc9437931d141e93 (patch)
tree34f1785ec4865b5721b74e6ff02f8c2f899b67fb
parentc6432d30823e5b5372e74290b34bf89af6ece52f (diff)
downloadnihav-e12dabcd04fc59677660fce8fc9437931d141e93.tar.gz
nihav_itu: ignore high-profile extradata tail when it is not correct
-rw-r--r--nihav-itu/src/codecs/h264/decoder_mt.rs5
-rw-r--r--nihav-itu/src/codecs/h264/decoder_st.rs5
2 files changed, 8 insertions, 2 deletions
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);