Relax requirement on reserved bits when parsing AVCC

Issue #44

Change-Id: I84235a4d94225e2bf1777443611ad19429b958d4
This commit is contained in:
KongQun Yang 2015-10-22 10:24:53 -07:00 committed by Gerrit Code Review
parent 074bce8425
commit 95d2dbf68d
2 changed files with 5 additions and 19 deletions

View File

@ -32,25 +32,12 @@ bool ExtractResolutionFromDecoderConfig(const uint8_t* avc_decoder_config_data,
RCHECK(reader.Read1(&value)); RCHECK(reader.Read1(&value));
RCHECK(value == 1); RCHECK(value == 1);
// avc profile. No value check. // Skip avc profile, profile compatibility, avc level, and length size.
RCHECK(reader.Read1(&value)); RCHECK(reader.SkipBytes(4));
// profile compatibility. No value check. // Reserved and num sps.
RCHECK(reader.Read1(&value)); 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; const uint8_t num_sps = value & 0x1F;
if (num_sps < 1) { if (num_sps < 1) {
LOG(ERROR) << "No SPS found."; LOG(ERROR) << "No SPS found.";

View File

@ -902,12 +902,11 @@ bool AVCDecoderConfigurationRecord::ParseData(BufferReader* reader) {
reader->Read1(&avc_level)); reader->Read1(&avc_level));
uint8_t length_size_minus_one; uint8_t length_size_minus_one;
RCHECK(reader->Read1(&length_size_minus_one) && RCHECK(reader->Read1(&length_size_minus_one));
(length_size_minus_one & 0xfc) == 0xfc);
length_size = (length_size_minus_one & 0x3) + 1; length_size = (length_size_minus_one & 0x3) + 1;
uint8_t num_sps; uint8_t num_sps;
RCHECK(reader->Read1(&num_sps) && (num_sps & 0xe0) == 0xe0); RCHECK(reader->Read1(&num_sps));
num_sps &= 0x1f; num_sps &= 0x1f;
sps_list.resize(num_sps); sps_list.resize(num_sps);