diff --git a/packager/media/filters/h264_parser.cc b/packager/media/filters/h264_parser.cc index ef51ea4129..afc91ad9ef 100644 --- a/packager/media/filters/h264_parser.cc +++ b/packager/media/filters/h264_parser.cc @@ -32,25 +32,12 @@ bool ExtractResolutionFromDecoderConfig(const uint8_t* avc_decoder_config_data, RCHECK(reader.Read1(&value)); RCHECK(value == 1); - // avc profile. No value check. - RCHECK(reader.Read1(&value)); + // Skip avc profile, profile compatibility, avc level, and length size. + RCHECK(reader.SkipBytes(4)); - // profile compatibility. No value check. + // Reserved and num sps. RCHECK(reader.Read1(&value)); - // avc level indication. No value check. - RCHECK(reader.Read1(&value)); - - // reserved and length sized minus one. - RCHECK(reader.Read1(&value)); - // upper 6 bits are reserved and must be 111111. - RCHECK((value & 0xFC) == 0xFC); - - // reserved and num sps. - RCHECK(reader.Read1(&value)); - // upper 3 bits are reserved for 0b111. - RCHECK((value & 0xE0) == 0xE0); - const uint8_t num_sps = value & 0x1F; if (num_sps < 1) { LOG(ERROR) << "No SPS found."; diff --git a/packager/media/formats/mp4/box_definitions.cc b/packager/media/formats/mp4/box_definitions.cc index 2f0e2fb82b..89d41fe6da 100644 --- a/packager/media/formats/mp4/box_definitions.cc +++ b/packager/media/formats/mp4/box_definitions.cc @@ -902,12 +902,11 @@ bool AVCDecoderConfigurationRecord::ParseData(BufferReader* reader) { reader->Read1(&avc_level)); uint8_t length_size_minus_one; - RCHECK(reader->Read1(&length_size_minus_one) && - (length_size_minus_one & 0xfc) == 0xfc); + RCHECK(reader->Read1(&length_size_minus_one)); length_size = (length_size_minus_one & 0x3) + 1; uint8_t num_sps; - RCHECK(reader->Read1(&num_sps) && (num_sps & 0xe0) == 0xe0); + RCHECK(reader->Read1(&num_sps)); num_sps &= 0x1f; sps_list.resize(num_sps);