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

Side by Side Diff: media/webm/webm_cluster_parser.cc

Issue 141013008: Report parse error for WebM clusters missing a timecode (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months 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
OLDNEW
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 if (result < 0) { 103 if (result < 0) {
104 cluster_ended_ = false; 104 cluster_ended_ = false;
105 return result; 105 return result;
106 } 106 }
107 107
108 cluster_ended_ = parser_.IsParsingComplete(); 108 cluster_ended_ = parser_.IsParsingComplete();
109 if (cluster_ended_) { 109 if (cluster_ended_) {
110 // If there were no buffers in this cluster, set the cluster start time to 110 // If there were no buffers in this cluster, set the cluster start time to
111 // be the |cluster_timecode_|. 111 // be the |cluster_timecode_|.
112 if (cluster_start_time_ == kNoTimestamp()) { 112 if (cluster_start_time_ == kNoTimestamp()) {
113 DCHECK_GT(cluster_timecode_, -1); 113 // If the cluster did not even have a |cluster_timecode_|, signal parse
114 // error.
115 if (cluster_timecode_ < 0)
116 return -1;
117
114 cluster_start_time_ = base::TimeDelta::FromMicroseconds( 118 cluster_start_time_ = base::TimeDelta::FromMicroseconds(
115 cluster_timecode_ * timecode_multiplier_); 119 cluster_timecode_ * timecode_multiplier_);
116 } 120 }
117 121
118 // Reset the parser if we're done parsing so that 122 // Reset the parser if we're done parsing so that
119 // it is ready to accept another cluster on the next 123 // it is ready to accept another cluster on the next
120 // call. 124 // call.
121 parser_.Reset(); 125 parser_.Reset();
122 126
123 last_block_timecode_ = -1; 127 last_block_timecode_ = -1;
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 WebMClusterParser::FindTextTrack(int track_num) { 462 WebMClusterParser::FindTextTrack(int track_num) {
459 const TextTrackMap::iterator it = text_track_map_.find(track_num); 463 const TextTrackMap::iterator it = text_track_map_.find(track_num);
460 464
461 if (it == text_track_map_.end()) 465 if (it == text_track_map_.end())
462 return NULL; 466 return NULL;
463 467
464 return &it->second; 468 return &it->second;
465 } 469 }
466 470
467 } // namespace media 471 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/webm/webm_cluster_parser_unittest.cc » ('j') | media/webm/webm_cluster_parser_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698