| Index: media/webm/webm_cluster_parser.cc
|
| ===================================================================
|
| --- media/webm/webm_cluster_parser.cc (revision 114032)
|
| +++ media/webm/webm_cluster_parser.cc (working copy)
|
| @@ -26,7 +26,6 @@
|
| audio_default_duration_(audio_default_duration),
|
| video_track_num_(video_track_num),
|
| video_default_duration_(video_default_duration),
|
| - parser_(kWebMIdCluster),
|
| last_block_timecode_(-1),
|
| cluster_timecode_(-1) {
|
| }
|
| @@ -34,25 +33,12 @@
|
| WebMClusterParser::~WebMClusterParser() {}
|
|
|
| int WebMClusterParser::Parse(const uint8* buf, int size) {
|
| + last_block_timecode_ = -1;
|
| + cluster_timecode_ = -1;
|
| audio_buffers_.clear();
|
| video_buffers_.clear();
|
|
|
| - int result = parser_.Parse(buf, size, this);
|
| -
|
| - if (result <= 0)
|
| - return result;
|
| -
|
| - if (parser_.IsParsingComplete()) {
|
| - // Reset the parser if we're done parsing so that
|
| - // it is ready to accept another cluster on the next
|
| - // call.
|
| - parser_.Reset();
|
| -
|
| - last_block_timecode_ = -1;
|
| - cluster_timecode_ = -1;
|
| - }
|
| -
|
| - return result;
|
| + return WebMParseListElement(buf, size, kWebMIdCluster, 1, this);
|
| }
|
|
|
| bool WebMClusterParser::OnListStart(int id) {
|
| @@ -81,17 +67,17 @@
|
| }
|
|
|
| bool WebMClusterParser::OnFloat(int id, double val) {
|
| - DVLOG(1) << "Unexpected float element with ID " << std::hex << id;
|
| + VLOG(1) << "Unexpected float element with ID " << std::hex << id;
|
| return false;
|
| }
|
|
|
| bool WebMClusterParser::OnBinary(int id, const uint8* data, int size) {
|
| - DVLOG(1) << "Unexpected binary element with ID " << std::hex << id;
|
| + VLOG(1) << "Unexpected binary element with ID " << std::hex << id;
|
| return false;
|
| }
|
|
|
| bool WebMClusterParser::OnString(int id, const std::string& str) {
|
| - DVLOG(1) << "Unexpected string element with ID " << std::hex << id;
|
| + VLOG(1) << "Unexpected string element with ID " << std::hex << id;
|
| return false;
|
| }
|
|
|
| @@ -99,17 +85,17 @@
|
| int flags,
|
| const uint8* data, int size) {
|
| if (cluster_timecode_ == -1) {
|
| - DVLOG(1) << "Got SimpleBlock before cluster timecode.";
|
| + VLOG(1) << "Got SimpleBlock before cluster timecode.";
|
| return false;
|
| }
|
|
|
| if (timecode < 0) {
|
| - DVLOG(1) << "Got SimpleBlock with negative timecode offset " << timecode;
|
| + VLOG(1) << "Got SimpleBlock with negative timecode offset " << timecode;
|
| return false;
|
| }
|
|
|
| if (last_block_timecode_ != -1 && timecode < last_block_timecode_) {
|
| - DVLOG(1) << "Got SimpleBlock with a timecode before the previous block.";
|
| + VLOG(1) << "Got SimpleBlock with a timecode before the previous block.";
|
| return false;
|
| }
|
|
|
| @@ -129,13 +115,13 @@
|
| buffer->SetDuration(video_default_duration_);
|
| queue = &video_buffers_;
|
| } else {
|
| - DVLOG(1) << "Unexpected track number " << track_num;
|
| + VLOG(1) << "Unexpected track number " << track_num;
|
| return false;
|
| }
|
|
|
| if (!queue->empty() &&
|
| buffer->GetTimestamp() == queue->back()->GetTimestamp()) {
|
| - DVLOG(1) << "Got SimpleBlock timecode is not strictly monotonically "
|
| + VLOG(1) << "Got SimpleBlock timecode is not strictly monotonically "
|
| << "increasing for track " << track_num;
|
| return false;
|
| }
|
|
|