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

Side by Side Diff: webrtc/modules/audio_coding/neteq/dtmf_tone_generator.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
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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 131
132 if (attenuation < 0 || attenuation > 63) { 132 if (attenuation < 0 || attenuation > 63) {
133 return kParameterError; // Invalid attenuation. 133 return kParameterError; // Invalid attenuation.
134 } 134 }
135 135
136 // Look up oscillator coefficient for low and high frequencies. 136 // Look up oscillator coefficient for low and high frequencies.
137 RTC_DCHECK_LE(0, fs_index); 137 RTC_DCHECK_LE(0, fs_index);
138 RTC_DCHECK_GT(arraysize(kCoeff1), fs_index); 138 RTC_DCHECK_GT(arraysize(kCoeff1), fs_index);
139 RTC_DCHECK_GT(arraysize(kCoeff2), fs_index); 139 RTC_DCHECK_GT(arraysize(kCoeff2), fs_index);
140 RTC_DCHECK_LE(0, event); 140 RTC_DCHECK_LE(0, event);
141 RTC_DCHECK_GT(arraysize(kCoeff1[fs_index]), static_cast<size_t>(event)); 141 RTC_DCHECK_GT(arraysize(kCoeff1[fs_index]), event);
142 RTC_DCHECK_GT(arraysize(kCoeff2[fs_index]), static_cast<size_t>(event)); 142 RTC_DCHECK_GT(arraysize(kCoeff2[fs_index]), event);
143 coeff1_ = kCoeff1[fs_index][event]; 143 coeff1_ = kCoeff1[fs_index][event];
144 coeff2_ = kCoeff2[fs_index][event]; 144 coeff2_ = kCoeff2[fs_index][event];
145 145
146 // Look up amplitude multiplier. 146 // Look up amplitude multiplier.
147 RTC_DCHECK_LE(0, attenuation); 147 RTC_DCHECK_LE(0, attenuation);
148 RTC_DCHECK_GT(arraysize(kAmplitude), static_cast<size_t>(attenuation)); 148 RTC_DCHECK_GT(arraysize(kAmplitude), attenuation);
149 amplitude_ = kAmplitude[attenuation]; 149 amplitude_ = kAmplitude[attenuation];
150 150
151 // Initialize sample history. 151 // Initialize sample history.
152 RTC_DCHECK_LE(0, fs_index); 152 RTC_DCHECK_LE(0, fs_index);
153 RTC_DCHECK_GT(arraysize(kInitValue1), fs_index); 153 RTC_DCHECK_GT(arraysize(kInitValue1), fs_index);
154 RTC_DCHECK_GT(arraysize(kInitValue2), fs_index); 154 RTC_DCHECK_GT(arraysize(kInitValue2), fs_index);
155 RTC_DCHECK_LE(0, event); 155 RTC_DCHECK_LE(0, event);
156 RTC_DCHECK_GT(arraysize(kInitValue1[fs_index]), static_cast<size_t>(event)); 156 RTC_DCHECK_GT(arraysize(kInitValue1[fs_index]), event);
157 RTC_DCHECK_GT(arraysize(kInitValue2[fs_index]), static_cast<size_t>(event)); 157 RTC_DCHECK_GT(arraysize(kInitValue2[fs_index]), event);
158 sample_history1_[0] = kInitValue1[fs_index][event]; 158 sample_history1_[0] = kInitValue1[fs_index][event];
159 sample_history1_[1] = 0; 159 sample_history1_[1] = 0;
160 sample_history2_[0] = kInitValue2[fs_index][event]; 160 sample_history2_[0] = kInitValue2[fs_index][event];
161 sample_history2_[1] = 0; 161 sample_history2_[1] = 0;
162 162
163 initialized_ = true; 163 initialized_ = true;
164 return 0; 164 return 0;
165 } 165 }
166 166
167 // Reset tone generator to uninitialized state. 167 // Reset tone generator to uninitialized state.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 } 209 }
210 210
211 return static_cast<int>(num_samples); 211 return static_cast<int>(num_samples);
212 } 212 }
213 213
214 bool DtmfToneGenerator::initialized() const { 214 bool DtmfToneGenerator::initialized() const {
215 return initialized_; 215 return initialized_;
216 } 216 }
217 217
218 } // namespace webrtc 218 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698