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

Side by Side Diff: webrtc/modules/audio_coding/acm2/audio_coding_module.cc

Issue 2714063002: Introduce dchecked_cast, and start using it (Closed)
Patch Set: Created 3 years, 9 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 } 363 }
364 364
365 frag->VerifyAndAllocateFragmentationHeader( 365 frag->VerifyAndAllocateFragmentationHeader(
366 static_cast<uint16_t>(info.redundant.size())); 366 static_cast<uint16_t>(info.redundant.size()));
367 frag->fragmentationVectorSize = static_cast<uint16_t>(info.redundant.size()); 367 frag->fragmentationVectorSize = static_cast<uint16_t>(info.redundant.size());
368 size_t offset = 0; 368 size_t offset = 0;
369 for (size_t i = 0; i < info.redundant.size(); ++i) { 369 for (size_t i = 0; i < info.redundant.size(); ++i) {
370 frag->fragmentationOffset[i] = offset; 370 frag->fragmentationOffset[i] = offset;
371 offset += info.redundant[i].encoded_bytes; 371 offset += info.redundant[i].encoded_bytes;
372 frag->fragmentationLength[i] = info.redundant[i].encoded_bytes; 372 frag->fragmentationLength[i] = info.redundant[i].encoded_bytes;
373 frag->fragmentationTimeDiff[i] = rtc::checked_cast<uint16_t>( 373 frag->fragmentationTimeDiff[i] = rtc::dchecked_cast<uint16_t>(
374 info.encoded_timestamp - info.redundant[i].encoded_timestamp); 374 info.encoded_timestamp - info.redundant[i].encoded_timestamp);
375 frag->fragmentationPlType[i] = info.redundant[i].payload_type; 375 frag->fragmentationPlType[i] = info.redundant[i].payload_type;
376 } 376 }
377 } 377 }
378 378
379 // Wraps a raw AudioEncoder pointer. The idea is that you can put one of these 379 // Wraps a raw AudioEncoder pointer. The idea is that you can put one of these
380 // in a unique_ptr, to protect the contained raw pointer from being deleted 380 // in a unique_ptr, to protect the contained raw pointer from being deleted
381 // when the unique_ptr expires. (This is of course a bad idea in general, but 381 // when the unique_ptr expires. (This is of course a bad idea in general, but
382 // backwards compatibility.) 382 // backwards compatibility.)
383 class RawAudioEncoderWrapper final : public AudioEncoder { 383 class RawAudioEncoderWrapper final : public AudioEncoder {
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after
1376 // Checks the validity of the parameters of the given codec 1376 // Checks the validity of the parameters of the given codec
1377 bool AudioCodingModule::IsCodecValid(const CodecInst& codec) { 1377 bool AudioCodingModule::IsCodecValid(const CodecInst& codec) {
1378 bool valid = acm2::RentACodec::IsCodecValid(codec); 1378 bool valid = acm2::RentACodec::IsCodecValid(codec);
1379 if (!valid) 1379 if (!valid)
1380 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, -1, 1380 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, -1,
1381 "Invalid codec setting"); 1381 "Invalid codec setting");
1382 return valid; 1382 return valid;
1383 } 1383 }
1384 1384
1385 } // namespace webrtc 1385 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698