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

Side by Side 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 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/filters/chunk_demuxer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/webm/webm_cluster_parser.h" 5 #include "media/webm/webm_cluster_parser.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "media/base/data_buffer.h" 8 #include "media/base/data_buffer.h"
9 #include "media/webm/webm_constants.h" 9 #include "media/webm/webm_constants.h"
10 10
(...skipping 14 matching lines...) Expand all
25 audio_track_num_(audio_track_num), 25 audio_track_num_(audio_track_num),
26 audio_default_duration_(audio_default_duration), 26 audio_default_duration_(audio_default_duration),
27 video_track_num_(video_track_num), 27 video_track_num_(video_track_num),
28 video_default_duration_(video_default_duration), 28 video_default_duration_(video_default_duration),
29 last_block_timecode_(-1), 29 last_block_timecode_(-1),
30 cluster_timecode_(-1) { 30 cluster_timecode_(-1) {
31 } 31 }
32 32
33 WebMClusterParser::~WebMClusterParser() {} 33 WebMClusterParser::~WebMClusterParser() {}
34 34
35 int WebMClusterParser::Parse(const uint8* buf, int size) { 35 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
36 audio_buffers_.clear();
37 video_buffers_.clear();
38
39 int id;
40 int64 element_size;
41 int result = WebMParseElementHeader(buf, size, &id, &element_size);
42
43 if (result <= 0)
44 return result;
45
46 if (id == kWebMIdCues) {
scherkus (not reviewing) 2011/12/03 01:56:51 sanity check: this branch checks for a CUES sectio
47 if (size < (result + element_size)) {
48 // We don't have the whole element yet. Signal we need more data.
49 return 0;
50 }
51 // Skip the element.
52 return result + element_size;
53 } else if (id != kWebMIdCluster) {
scherkus (not reviewing) 2011/12/03 01:56:51 nit: no need for else
54 VLOG(1) << "Unexpected ID 0x" << std::hex << id;
scherkus (not reviewing) 2011/12/03 01:56:51 DVLOG
55 return -1;
56 }
57
36 last_block_timecode_ = -1; 58 last_block_timecode_ = -1;
37 cluster_timecode_ = -1; 59 cluster_timecode_ = -1;
38 audio_buffers_.clear();
39 video_buffers_.clear();
40 60
41 return WebMParseListElement(buf, size, kWebMIdCluster, 1, this); 61 return WebMParseListElement(buf, size, kWebMIdCluster, 1, this);
42 } 62 }
43 63
44 bool WebMClusterParser::OnListStart(int id) { 64 bool WebMClusterParser::OnListStart(int id) {
45 if (id == kWebMIdCluster) 65 if (id == kWebMIdCluster)
46 cluster_timecode_ = -1; 66 cluster_timecode_ = -1;
47 67
48 return true; 68 return true;
49 } 69 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 VLOG(1) << "Got SimpleBlock timecode is not strictly monotonically " 144 VLOG(1) << "Got SimpleBlock timecode is not strictly monotonically "
125 << "increasing for track " << track_num; 145 << "increasing for track " << track_num;
126 return false; 146 return false;
127 } 147 }
128 148
129 queue->push_back(buffer); 149 queue->push_back(buffer);
130 return true; 150 return true;
131 } 151 }
132 152
133 } // namespace media 153 } // namespace media
OLDNEW
« 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