Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(654)

Unified Diff: media/formats/mp4/box_definitions.cc

Issue 264743016: Change H264AnnexBBitstreamConverter to use AVCDecoderConfigurationRecord. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address CR comments. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/formats/mp4/box_definitions.h ('k') | media/formats/mp4/box_reader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/formats/mp4/box_definitions.cc
diff --git a/media/formats/mp4/box_definitions.cc b/media/formats/mp4/box_definitions.cc
index 1912aaeb640fef0a46d07579f70a51eaad78559b..5b67633252c58565a15da78626f328e7237351cd 100644
--- a/media/formats/mp4/box_definitions.cc
+++ b/media/formats/mp4/box_definitions.cc
@@ -349,6 +349,15 @@ AVCDecoderConfigurationRecord::~AVCDecoderConfigurationRecord() {}
FourCC AVCDecoderConfigurationRecord::BoxType() const { return FOURCC_AVCC; }
bool AVCDecoderConfigurationRecord::Parse(BoxReader* reader) {
+ return ParseInternal(reader);
+}
+
+bool AVCDecoderConfigurationRecord::Parse(const uint8* data, int data_size) {
+ BufferReader reader(data, data_size);
+ return ParseInternal(&reader);
+}
+
+bool AVCDecoderConfigurationRecord::ParseInternal(BufferReader* reader) {
RCHECK(reader->Read1(&version) && version == 1 &&
reader->Read1(&profile_indication) &&
reader->Read1(&profile_compatibility) &&
@@ -359,6 +368,8 @@ bool AVCDecoderConfigurationRecord::Parse(BoxReader* reader) {
(length_size_minus_one & 0xfc) == 0xfc);
length_size = (length_size_minus_one & 0x3) + 1;
+ RCHECK(length_size != 3); // Only values of 1, 2, and 4 are valid.
+
uint8 num_sps;
RCHECK(reader->Read1(&num_sps) && (num_sps & 0xe0) == 0xe0);
num_sps &= 0x1f;
« no previous file with comments | « media/formats/mp4/box_definitions.h ('k') | media/formats/mp4/box_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698