summaryrefslogtreecommitdiffstats
path: root/media/mp4
diff options
context:
space:
mode:
authorstrobe@google.com <strobe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-28 02:22:03 +0000
committerstrobe@google.com <strobe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-28 02:22:03 +0000
commit66fcdd5d8b6faeefc391a91ac9a4c885691c960c (patch)
treea30652643289353144776db8b0c41b806bc565a0 /media/mp4
parent9313bd4f517c43275b73901115c615c981347891 (diff)
downloadchromium_src-66fcdd5d8b6faeefc391a91ac9a4c885691c960c.zip
chromium_src-66fcdd5d8b6faeefc391a91ac9a4c885691c960c.tar.gz
chromium_src-66fcdd5d8b6faeefc391a91ac9a4c885691c960c.tar.bz2
Ignore unrecognized protection schemes in ISO BMFF files.
BUG= TEST=Manual, in browser Review URL: https://chromiumcodereview.appspot.com/10827079 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148874 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/mp4')
-rw-r--r--media/mp4/box_definitions.cc32
1 files changed, 25 insertions, 7 deletions
diff --git a/media/mp4/box_definitions.cc b/media/mp4/box_definitions.cc
index d6ab0fc..9b64f48 100644
--- a/media/mp4/box_definitions.cc
+++ b/media/mp4/box_definitions.cc
@@ -91,7 +91,6 @@ bool SchemeType::Parse(BoxReader* reader) {
RCHECK(reader->ReadFullBoxHeader() &&
reader->ReadFourCC(&type) &&
reader->Read4(&version));
- RCHECK(type == FOURCC_CENC);
return true;
}
@@ -132,8 +131,13 @@ FourCC ProtectionSchemeInfo::BoxType() const { return FOURCC_SINF; }
bool ProtectionSchemeInfo::Parse(BoxReader* reader) {
RCHECK(reader->ScanChildren() &&
reader->ReadChild(&format) &&
- reader->ReadChild(&type) &&
- reader->ReadChild(&info));
+ reader->ReadChild(&type));
+ if (type.type == FOURCC_CENC)
+ RCHECK(reader->ReadChild(&info));
+ // Other protection schemes are silently ignored. Since the protection scheme
+ // type can't be determined until this box is opened, we return 'true' for
+ // non-CENC protection scheme types. It is the parent box's responsibility to
+ // ensure that this scheme type is a supported one.
return true;
}
@@ -381,8 +385,15 @@ bool VideoSampleEntry::Parse(BoxReader* reader) {
RCHECK(reader->ScanChildren() &&
reader->MaybeReadChild(&pixel_aspect));
- if (format == FOURCC_ENCV)
- RCHECK(reader->ReadChild(&sinf));
+ if (format == FOURCC_ENCV) {
+ // Continue scanning until a recognized protection scheme is found, or until
+ // we run out of protection schemes.
+ while (sinf.type.type != FOURCC_CENC) {
+ if (!reader->ReadChild(&sinf))
+ return false;
+ }
+ }
+
if (format == FOURCC_AVC1 ||
(format == FOURCC_ENCV && sinf.format.format == FOURCC_AVC1)) {
RCHECK(reader->ReadChild(&avcc));
@@ -442,8 +453,15 @@ bool AudioSampleEntry::Parse(BoxReader* reader) {
samplerate >>= 16;
RCHECK(reader->ScanChildren());
- if (format == FOURCC_ENCA)
- RCHECK(reader->ReadChild(&sinf));
+ if (format == FOURCC_ENCA) {
+ // Continue scanning until a recognized protection scheme is found, or until
+ // we run out of protection schemes.
+ while (sinf.type.type != FOURCC_CENC) {
+ if (!reader->ReadChild(&sinf))
+ return false;
+ }
+ }
+
RCHECK(reader->ReadChild(&esds));
return true;
}