| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/sys_byteorder.h" | 10 #include "base/sys_byteorder.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 audio_.Reset(); | 51 audio_.Reset(); |
| 52 video_.Reset(); | 52 video_.Reset(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 int WebMClusterParser::Parse(const uint8* buf, int size) { | 55 int WebMClusterParser::Parse(const uint8* buf, int size) { |
| 56 audio_.Reset(); | 56 audio_.Reset(); |
| 57 video_.Reset(); | 57 video_.Reset(); |
| 58 | 58 |
| 59 int result = parser_.Parse(buf, size); | 59 int result = parser_.Parse(buf, size); |
| 60 | 60 |
| 61 if (result <= 0) { | 61 if (result < 0) { |
| 62 cluster_ended_ = false; | 62 cluster_ended_ = false; |
| 63 return result; | 63 return result; |
| 64 } | 64 } |
| 65 | 65 |
| 66 cluster_ended_ = parser_.IsParsingComplete(); | 66 cluster_ended_ = parser_.IsParsingComplete(); |
| 67 if (cluster_ended_) { | 67 if (cluster_ended_) { |
| 68 // If there were no buffers in this cluster, set the cluster start time to | 68 // If there were no buffers in this cluster, set the cluster start time to |
| 69 // be the |cluster_timecode_|. | 69 // be the |cluster_timecode_|. |
| 70 if (cluster_start_time_ == kNoTimestamp()) { | 70 if (cluster_start_time_ == kNoTimestamp()) { |
| 71 DCHECK_GT(cluster_timecode_, -1); | 71 DCHECK_GT(cluster_timecode_, -1); |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 | 282 |
| 283 buffers_.push_back(buffer); | 283 buffers_.push_back(buffer); |
| 284 return true; | 284 return true; |
| 285 } | 285 } |
| 286 | 286 |
| 287 void WebMClusterParser::Track::Reset() { | 287 void WebMClusterParser::Track::Reset() { |
| 288 buffers_.clear(); | 288 buffers_.clear(); |
| 289 } | 289 } |
| 290 | 290 |
| 291 } // namespace media | 291 } // namespace media |
| OLD | NEW |