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

Side by Side Diff: webrtc/modules/audio_coding/acm2/acm_receiver.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) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 audio_frame->data_); 155 audio_frame->data_);
156 if (samples_per_channel_int < 0) { 156 if (samples_per_channel_int < 0) {
157 LOG(LERROR) << "AcmReceiver::GetAudio - Resampling audio_buffer_ failed."; 157 LOG(LERROR) << "AcmReceiver::GetAudio - Resampling audio_buffer_ failed.";
158 return -1; 158 return -1;
159 } 159 }
160 audio_frame->samples_per_channel_ = 160 audio_frame->samples_per_channel_ =
161 static_cast<size_t>(samples_per_channel_int); 161 static_cast<size_t>(samples_per_channel_int);
162 audio_frame->sample_rate_hz_ = desired_freq_hz; 162 audio_frame->sample_rate_hz_ = desired_freq_hz;
163 RTC_DCHECK_EQ( 163 RTC_DCHECK_EQ(
164 audio_frame->sample_rate_hz_, 164 audio_frame->sample_rate_hz_,
165 rtc::checked_cast<int>(audio_frame->samples_per_channel_ * 100)); 165 rtc::dchecked_cast<int>(audio_frame->samples_per_channel_ * 100));
166 resampled_last_output_frame_ = true; 166 resampled_last_output_frame_ = true;
167 } else { 167 } else {
168 resampled_last_output_frame_ = false; 168 resampled_last_output_frame_ = false;
169 // We might end up here ONLY if codec is changed. 169 // We might end up here ONLY if codec is changed.
170 } 170 }
171 171
172 // Store current audio in |last_audio_buffer_| for next time. 172 // Store current audio in |last_audio_buffer_| for next time.
173 memcpy(last_audio_buffer_.get(), audio_frame->data_, 173 memcpy(last_audio_buffer_.get(), audio_frame->data_,
174 sizeof(int16_t) * audio_frame->samples_per_channel_ * 174 sizeof(int16_t) * audio_frame->samples_per_channel_ *
175 audio_frame->num_channels_); 175 audio_frame->num_channels_);
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 387
388 void AcmReceiver::GetDecodingCallStatistics( 388 void AcmReceiver::GetDecodingCallStatistics(
389 AudioDecodingCallStats* stats) const { 389 AudioDecodingCallStats* stats) const {
390 rtc::CritScope lock(&crit_sect_); 390 rtc::CritScope lock(&crit_sect_);
391 *stats = call_stats_.GetDecodingStatistics(); 391 *stats = call_stats_.GetDecodingStatistics();
392 } 392 }
393 393
394 } // namespace acm2 394 } // namespace acm2
395 395
396 } // namespace webrtc 396 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698