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

Unified Diff: media/webm/webm_cluster_parser.cc

Issue 8775035: Add support for incremental cluster parsing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: _ Created 9 years, 1 month 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/filters/chunk_demuxer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/webm/webm_cluster_parser.cc
diff --git a/media/webm/webm_cluster_parser.cc b/media/webm/webm_cluster_parser.cc
index 8eb045cbf8a3e3ffdf577868bce4c0dd3eb86683..995578cd988012600de699b6c4651fd5eb7cc57f 100644
--- a/media/webm/webm_cluster_parser.cc
+++ b/media/webm/webm_cluster_parser.cc
@@ -33,11 +33,31 @@ WebMClusterParser::WebMClusterParser(int64 timecode_scale,
WebMClusterParser::~WebMClusterParser() {}
int WebMClusterParser::Parse(const uint8* buf, int size) {
scherkus (not reviewing) 2011/12/03 01:56:51 perhaps the .h docs need to be updated because I'm
- last_block_timecode_ = -1;
- cluster_timecode_ = -1;
audio_buffers_.clear();
video_buffers_.clear();
+ int id;
+ int64 element_size;
+ int result = WebMParseElementHeader(buf, size, &id, &element_size);
+
+ if (result <= 0)
+ return result;
+
+ if (id == kWebMIdCues) {
scherkus (not reviewing) 2011/12/03 01:56:51 sanity check: this branch checks for a CUES sectio
+ if (size < (result + element_size)) {
+ // We don't have the whole element yet. Signal we need more data.
+ return 0;
+ }
+ // Skip the element.
+ return result + element_size;
+ } else if (id != kWebMIdCluster) {
scherkus (not reviewing) 2011/12/03 01:56:51 nit: no need for else
+ VLOG(1) << "Unexpected ID 0x" << std::hex << id;
scherkus (not reviewing) 2011/12/03 01:56:51 DVLOG
+ return -1;
+ }
+
+ last_block_timecode_ = -1;
+ cluster_timecode_ = -1;
+
return WebMParseListElement(buf, size, kWebMIdCluster, 1, this);
}
« no previous file with comments | « media/filters/chunk_demuxer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698