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

Side by Side Diff: webrtc/modules/audio_mixer/audio_frame_manipulator.cc

Issue 2535593002: RTC_[D]CHECK_op: Remove "u" suffix on integer constants (Closed)
Patch Set: 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 13 matching lines...) Expand all
24 } 24 }
25 return energy; 25 return energy;
26 } 26 }
27 27
28 void Ramp(float start_gain, float target_gain, AudioFrame* audio_frame) { 28 void Ramp(float start_gain, float target_gain, AudioFrame* audio_frame) {
29 RTC_DCHECK(audio_frame); 29 RTC_DCHECK(audio_frame);
30 RTC_DCHECK_GE(start_gain, 0.0f); 30 RTC_DCHECK_GE(start_gain, 0.0f);
31 RTC_DCHECK_GE(target_gain, 0.0f); 31 RTC_DCHECK_GE(target_gain, 0.0f);
32 32
33 size_t samples = audio_frame->samples_per_channel_; 33 size_t samples = audio_frame->samples_per_channel_;
34 RTC_DCHECK_LT(0u, samples); 34 RTC_DCHECK_LT(0, samples);
35 float increment = (target_gain - start_gain) / samples; 35 float increment = (target_gain - start_gain) / samples;
36 float gain = start_gain; 36 float gain = start_gain;
37 for (size_t i = 0; i < samples; ++i) { 37 for (size_t i = 0; i < samples; ++i) {
38 // If the audio is interleaved of several channels, we want to 38 // If the audio is interleaved of several channels, we want to
39 // apply the same gain change to the ith sample of every channel. 39 // apply the same gain change to the ith sample of every channel.
40 for (size_t ch = 0; ch < audio_frame->num_channels_; ++ch) { 40 for (size_t ch = 0; ch < audio_frame->num_channels_; ++ch) {
41 audio_frame->data_[audio_frame->num_channels_ * i + ch] *= gain; 41 audio_frame->data_[audio_frame->num_channels_ * i + ch] *= gain;
42 } 42 }
43 gain += increment; 43 gain += increment;
44 } 44 }
45 } 45 }
46 46
47 void RemixFrame(size_t target_number_of_channels, AudioFrame* frame) { 47 void RemixFrame(size_t target_number_of_channels, AudioFrame* frame) {
48 RTC_DCHECK_GE(target_number_of_channels, 1u); 48 RTC_DCHECK_GE(target_number_of_channels, 1);
49 RTC_DCHECK_LE(target_number_of_channels, 2u); 49 RTC_DCHECK_LE(target_number_of_channels, 2);
50 if (frame->num_channels_ == 1 && target_number_of_channels == 2) { 50 if (frame->num_channels_ == 1 && target_number_of_channels == 2) {
51 AudioFrameOperations::MonoToStereo(frame); 51 AudioFrameOperations::MonoToStereo(frame);
52 } else if (frame->num_channels_ == 2 && target_number_of_channels == 1) { 52 } else if (frame->num_channels_ == 2 && target_number_of_channels == 1) {
53 AudioFrameOperations::StereoToMono(frame); 53 AudioFrameOperations::StereoToMono(frame);
54 } 54 }
55 } 55 }
56 } // namespace webrtc 56 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_device/ios/audio_device_ios.mm ('k') | webrtc/modules/audio_processing/aec/aec_core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698