OLD | NEW |
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 |
| 11 #include "webrtc/audio/utility/audio_frame_operations.h" |
| 12 #include "webrtc/base/checks.h" |
11 #include "webrtc/modules/audio_mixer/audio_frame_manipulator.h" | 13 #include "webrtc/modules/audio_mixer/audio_frame_manipulator.h" |
12 #include "webrtc/audio/utility/audio_frame_operations.h" | |
13 #include "webrtc/modules/include/module_common_types.h" | 14 #include "webrtc/modules/include/module_common_types.h" |
14 #include "webrtc/rtc_base/checks.h" | |
15 | 15 |
16 namespace webrtc { | 16 namespace webrtc { |
17 | 17 |
18 uint32_t AudioMixerCalculateEnergy(const AudioFrame& audio_frame) { | 18 uint32_t AudioMixerCalculateEnergy(const AudioFrame& audio_frame) { |
19 if (audio_frame.muted()) { | 19 if (audio_frame.muted()) { |
20 return 0; | 20 return 0; |
21 } | 21 } |
22 | 22 |
23 uint32_t energy = 0; | 23 uint32_t energy = 0; |
24 const int16_t* frame_data = audio_frame.data(); | 24 const int16_t* frame_data = audio_frame.data(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 void RemixFrame(size_t target_number_of_channels, AudioFrame* frame) { | 56 void RemixFrame(size_t target_number_of_channels, AudioFrame* frame) { |
57 RTC_DCHECK_GE(target_number_of_channels, 1); | 57 RTC_DCHECK_GE(target_number_of_channels, 1); |
58 RTC_DCHECK_LE(target_number_of_channels, 2); | 58 RTC_DCHECK_LE(target_number_of_channels, 2); |
59 if (frame->num_channels_ == 1 && target_number_of_channels == 2) { | 59 if (frame->num_channels_ == 1 && target_number_of_channels == 2) { |
60 AudioFrameOperations::MonoToStereo(frame); | 60 AudioFrameOperations::MonoToStereo(frame); |
61 } else if (frame->num_channels_ == 2 && target_number_of_channels == 1) { | 61 } else if (frame->num_channels_ == 2 && target_number_of_channels == 1) { |
62 AudioFrameOperations::StereoToMono(frame); | 62 AudioFrameOperations::StereoToMono(frame); |
63 } | 63 } |
64 } | 64 } |
65 } // namespace webrtc | 65 } // namespace webrtc |
OLD | NEW |