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

Unified Diff: media/webm/webm_info_parser.cc

Issue 8775035: Add support for incremental cluster parsing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address CR comments & include new unit tests this time" Created 9 years 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
Index: media/webm/webm_info_parser.cc
diff --git a/media/webm/webm_info_parser.cc b/media/webm/webm_info_parser.cc
index 41e1a25138abe08471b59f6f71e046bfc0b67813..5807d7e3883e7e6c883c3762173f18884536df6e 100644
--- a/media/webm/webm_info_parser.cc
+++ b/media/webm/webm_info_parser.cc
@@ -17,7 +17,17 @@ WebMInfoParser::WebMInfoParser()
WebMInfoParser::~WebMInfoParser() {}
int WebMInfoParser::Parse(const uint8* buf, int size) {
- return WebMParseListElement(buf, size, kWebMIdInfo, 1, this);
+ timecode_scale_ = -1;
+ duration_ = -1;
+
+ WebMListParser parser(kWebMIdInfo);
+ int result = parser.Parse(buf, size, this);
+
+ if (result <= 0)
+ return result;
+
+ // For now we do all or nothing parsing.
+ return parser.IsParsingComplete() ? result : 0;
}
bool WebMInfoParser::OnListStart(int id) { return true; }
@@ -36,7 +46,7 @@ bool WebMInfoParser::OnUInt(int id, int64 val) {
return true;
if (timecode_scale_ != -1) {
- VLOG(1) << "Multiple values for id " << std::hex << id << " specified";
+ DVLOG(1) << "Multiple values for id " << std::hex << id << " specified";
return false;
}
@@ -46,12 +56,12 @@ bool WebMInfoParser::OnUInt(int id, int64 val) {
bool WebMInfoParser::OnFloat(int id, double val) {
if (id != kWebMIdDuration) {
- VLOG(1) << "Unexpected float for id" << std::hex << id;
+ DVLOG(1) << "Unexpected float for id" << std::hex << id;
return false;
}
if (duration_ != -1) {
- VLOG(1) << "Multiple values for duration.";
+ DVLOG(1) << "Multiple values for duration.";
return false;
}

Powered by Google App Engine
This is Rietveld 408576698