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

Side by Side Diff: webrtc/audio/audio_transport_proxy.cc

Issue 2534683002: RTC_[D]CHECK_op: Remove superfluous casts (Closed)
Patch Set: test Created 4 years 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
« no previous file with comments | « no previous file | webrtc/base/checks.h » ('j') | webrtc/base/safe_compare.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 RTC_NOTREACHED(); 103 RTC_NOTREACHED();
104 } 104 }
105 105
106 void AudioTransportProxy::PullRenderData(int bits_per_sample, 106 void AudioTransportProxy::PullRenderData(int bits_per_sample,
107 int sample_rate, 107 int sample_rate,
108 size_t number_of_channels, 108 size_t number_of_channels,
109 size_t number_of_frames, 109 size_t number_of_frames,
110 void* audio_data, 110 void* audio_data,
111 int64_t* elapsed_time_ms, 111 int64_t* elapsed_time_ms,
112 int64_t* ntp_time_ms) { 112 int64_t* ntp_time_ms) {
113 RTC_DCHECK_EQ(static_cast<size_t>(bits_per_sample), 16); 113 RTC_DCHECK_EQ(bits_per_sample, 16);
114 RTC_DCHECK_GE(number_of_channels, 1); 114 RTC_DCHECK_GE(number_of_channels, 1);
115 RTC_DCHECK_LE(number_of_channels, 2); 115 RTC_DCHECK_LE(number_of_channels, 2);
116 RTC_DCHECK_GE(static_cast<int>(sample_rate), 116 RTC_DCHECK_GE(sample_rate, AudioProcessing::NativeRate::kSampleRate8kHz);
117 AudioProcessing::NativeRate::kSampleRate8kHz);
118 117
119 // 100 = 1 second / data duration (10 ms). 118 // 100 = 1 second / data duration (10 ms).
120 RTC_DCHECK_EQ(static_cast<int>(number_of_frames * 100), sample_rate); 119 RTC_DCHECK_EQ(number_of_frames * 100, sample_rate);
121 120
122 // 8 = bits per byte. 121 // 8 = bits per byte.
123 RTC_DCHECK_LE(bits_per_sample / 8 * number_of_frames * number_of_channels, 122 RTC_DCHECK_LE(bits_per_sample / 8 * number_of_frames * number_of_channels,
124 sizeof(AudioFrame::data_)); 123 sizeof(AudioFrame::data_));
125 mixer_->Mix(number_of_channels, &mixed_frame_); 124 mixer_->Mix(number_of_channels, &mixed_frame_);
126 *elapsed_time_ms = mixed_frame_.elapsed_time_ms_; 125 *elapsed_time_ms = mixed_frame_.elapsed_time_ms_;
127 *ntp_time_ms = mixed_frame_.ntp_time_ms_; 126 *ntp_time_ms = mixed_frame_.ntp_time_ms_;
128 127
129 const auto output_samples = Resample(mixed_frame_, sample_rate, &resampler_, 128 const auto output_samples = Resample(mixed_frame_, sample_rate, &resampler_,
130 static_cast<int16_t*>(audio_data)); 129 static_cast<int16_t*>(audio_data));
131 RTC_DCHECK_EQ(output_samples, number_of_channels * number_of_frames); 130 RTC_DCHECK_EQ(output_samples, number_of_channels * number_of_frames);
132 } 131 }
133 132
134 } // namespace webrtc 133 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/base/checks.h » ('j') | webrtc/base/safe_compare.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698