OLD | NEW |
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 15 matching lines...) Expand all Loading... |
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 parser_(kWebMIdCluster), | 29 parser_(kWebMIdCluster), |
30 last_block_timecode_(-1), | 30 last_block_timecode_(-1), |
31 cluster_timecode_(-1) { | 31 cluster_timecode_(-1) { |
32 } | 32 } |
33 | 33 |
34 WebMClusterParser::~WebMClusterParser() {} | 34 WebMClusterParser::~WebMClusterParser() {} |
35 | 35 |
36 void WebMClusterParser::Reset() { | |
37 audio_buffers_.clear(); | |
38 video_buffers_.clear(); | |
39 last_block_timecode_ = -1; | |
40 cluster_timecode_ = -1; | |
41 parser_.Reset(); | |
42 } | |
43 | |
44 int WebMClusterParser::Parse(const uint8* buf, int size) { | 36 int WebMClusterParser::Parse(const uint8* buf, int size) { |
45 audio_buffers_.clear(); | 37 audio_buffers_.clear(); |
46 video_buffers_.clear(); | 38 video_buffers_.clear(); |
47 | 39 |
48 int result = parser_.Parse(buf, size, this); | 40 int result = parser_.Parse(buf, size, this); |
49 | 41 |
50 if (result <= 0) | 42 if (result <= 0) |
51 return result; | 43 return result; |
52 | 44 |
53 if (parser_.IsParsingComplete()) { | 45 if (parser_.IsParsingComplete()) { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 DVLOG(1) << "Got SimpleBlock timecode is not strictly monotonically " | 138 DVLOG(1) << "Got SimpleBlock timecode is not strictly monotonically " |
147 << "increasing for track " << track_num; | 139 << "increasing for track " << track_num; |
148 return false; | 140 return false; |
149 } | 141 } |
150 | 142 |
151 queue->push_back(buffer); | 143 queue->push_back(buffer); |
152 return true; | 144 return true; |
153 } | 145 } |
154 | 146 |
155 } // namespace media | 147 } // namespace media |
OLD | NEW |