Chromium Code Reviews| Index: media/mp4/box_definitions.cc |
| diff --git a/media/mp4/box_definitions.cc b/media/mp4/box_definitions.cc |
| index 5d18c32182f0db20f236ed283af903a75fa213d5..fb9723006fb8aa7528092ddb9113d5bedc5a329d 100644 |
| --- a/media/mp4/box_definitions.cc |
| +++ b/media/mp4/box_definitions.cc |
| @@ -85,7 +85,7 @@ SchemeType::~SchemeType() {} |
| FourCC SchemeType::BoxType() const { return FOURCC_SCHM; } |
| bool SchemeType::Parse(BoxReader* reader) { |
| - RCHECK(reader->SkipBytes(4) && |
| + RCHECK(reader->ReadFullBoxHeader() && |
|
ddorwin
2012/06/26 06:09:19
Why all the RCHECKs? Macros are discouraged, and t
strobe_
2012/06/27 02:01:21
The alternatives were worse. ;)
There are some tr
|
| reader->ReadFourCC(&type) && |
| reader->Read4(&version)); |
| RCHECK(type == FOURCC_CENC); |
| @@ -100,7 +100,8 @@ FourCC TrackEncryption::BoxType() const { return FOURCC_TENC; } |
| bool TrackEncryption::Parse(BoxReader* reader) { |
| uint8 flag; |
| - RCHECK(reader->SkipBytes(2) && |
| + RCHECK(reader->ReadFullBoxHeader() && |
| + reader->SkipBytes(2) && |
| reader->Read1(&flag) && |
| reader->Read1(&default_iv_size) && |
| reader->ReadVec(&default_kid, 16)); |
| @@ -126,9 +127,10 @@ ProtectionSchemeInfo::~ProtectionSchemeInfo() {} |
| FourCC ProtectionSchemeInfo::BoxType() const { return FOURCC_SINF; } |
| bool ProtectionSchemeInfo::Parse(BoxReader* reader) { |
| - return reader->ScanChildren() && |
| + RCHECK(reader->ScanChildren() && |
| reader->ReadChild(&type) && |
| - reader->ReadChild(&info); |
| + reader->ReadChild(&info)); |
| + return true; |
| } |
| MovieHeader::MovieHeader() |
| @@ -362,19 +364,12 @@ bool VideoSampleEntry::Parse(BoxReader* reader) { |
| reader->Read2(&height) && |
| reader->SkipBytes(50)); |
| + // TODO(strobe): Finalize format signaling for encrypted media |
| + // (http://crbug.com/132351). For now, we assume that every video track is |
| + // AVC, and that any track may have a Common Encryption header regardless of |
| + // format. |
| RCHECK(reader->ScanChildren()); |
| - if (format == FOURCC_ENCV) { |
| - RCHECK(reader->ReadChild(&sinf)); |
| - } |
| - |
| - // TODO(strobe): finalize format signaling for encrypted media |
| - // (http://crbug.com/132351) |
| - // |
| - // if (format == FOURCC_AVC1 || |
| - // (format == FOURCC_ENCV && |
| - // sinf.format.format == FOURCC_AVC1)) { |
| - RCHECK(reader->ReadChild(&avcc)); |
| - // } |
| + RCHECK(reader->ReadChild(&avcc) && reader->MaybeReadChild(&sinf)); |
| return true; |
| } |
| @@ -404,10 +399,8 @@ bool AudioSampleEntry::Parse(BoxReader* reader) { |
| // Convert from 16.16 fixed point to integer |
| samplerate >>= 16; |
| - RCHECK(reader->ScanChildren()); |
| - if (format == FOURCC_ENCA) { |
| - RCHECK(reader->ReadChild(&sinf)); |
| - } |
| + RCHECK(reader->ScanChildren() && |
| + reader->MaybeReadChild(&sinf)); |
| return true; |
| } |