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

Side by Side Diff: media/formats/mp2t/es_parser_h264.cc

Issue 2481903002: Make checked_cast a constexpr (Closed)
Patch Set: nit Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/formats/mp2t/es_parser_h264.h" 5 #include "media/formats/mp2t/es_parser_h264.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/numerics/safe_conversions.h" 10 #include "base/numerics/safe_conversions.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 if (!FindAUD(&next_access_unit_pos_)) 121 if (!FindAUD(&next_access_unit_pos_))
122 return true; 122 return true;
123 123
124 // At this point, we know we have a full access unit. 124 // At this point, we know we have a full access unit.
125 bool is_key_frame = false; 125 bool is_key_frame = false;
126 int pps_id_for_access_unit = -1; 126 int pps_id_for_access_unit = -1;
127 127
128 const uint8_t* es; 128 const uint8_t* es;
129 int size; 129 int size;
130 es_queue_->PeekAt(current_access_unit_pos_, &es, &size); 130 es_queue_->PeekAt(current_access_unit_pos_, &es, &size);
131 int access_unit_size = base::checked_cast<int, int64_t>( 131 int access_unit_size = base::checked_cast<int>(
132 next_access_unit_pos_ - current_access_unit_pos_); 132 next_access_unit_pos_ - current_access_unit_pos_);
133 DCHECK_LE(access_unit_size, size); 133 DCHECK_LE(access_unit_size, size);
134 h264_parser_->SetStream(es, access_unit_size); 134 h264_parser_->SetStream(es, access_unit_size);
135 135
136 while (true) { 136 while (true) {
137 bool is_eos = false; 137 bool is_eos = false;
138 H264NALU nalu; 138 H264NALU nalu;
139 switch (h264_parser_->AdvanceToNextNALU(&nalu)) { 139 switch (h264_parser_->AdvanceToNextNALU(&nalu)) {
140 case H264Parser::kOk: 140 case H264Parser::kOk:
141 break; 141 break;
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 << " height=" << sps->sar_height; 296 << " height=" << sps->sar_height;
297 last_video_decoder_config_ = video_decoder_config; 297 last_video_decoder_config_ = video_decoder_config;
298 es_adapter_.OnConfigChanged(video_decoder_config); 298 es_adapter_.OnConfigChanged(video_decoder_config);
299 } 299 }
300 300
301 return true; 301 return true;
302 } 302 }
303 303
304 } // namespace mp2t 304 } // namespace mp2t
305 } // namespace media 305 } // namespace media
OLDNEW
« no previous file with comments | « components/autofill/core/common/save_password_progress_logger.cc ('k') | storage/browser/blob/blob_data_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698