| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 } else { | 128 } else { |
| 129 std::transform(add_buffer.begin(), add_buffer.begin() + frame_length, | 129 std::transform(add_buffer.begin(), add_buffer.begin() + frame_length, |
| 130 audio_frame_for_mixing->data_, | 130 audio_frame_for_mixing->data_, |
| 131 [](int32_t a) { return rtc::saturated_cast<int16_t>(a); }); | 131 [](int32_t a) { return rtc::saturated_cast<int16_t>(a); }); |
| 132 } | 132 } |
| 133 } | 133 } |
| 134 | 134 |
| 135 std::unique_ptr<AudioProcessing> CreateLimiter() { | 135 std::unique_ptr<AudioProcessing> CreateLimiter() { |
| 136 Config config; | 136 Config config; |
| 137 config.Set<ExperimentalAgc>(new ExperimentalAgc(false)); | 137 config.Set<ExperimentalAgc>(new ExperimentalAgc(false)); |
| 138 |
| 138 std::unique_ptr<AudioProcessing> limiter(AudioProcessing::Create(config)); | 139 std::unique_ptr<AudioProcessing> limiter(AudioProcessing::Create(config)); |
| 139 RTC_DCHECK(limiter); | 140 RTC_DCHECK(limiter); |
| 140 | 141 |
| 142 webrtc::AudioProcessing::Config apm_config; |
| 143 apm_config.residual_echo_detector.enabled = false; |
| 144 limiter->ApplyConfig(apm_config); |
| 145 |
| 141 const auto check_no_error = [](int x) { | 146 const auto check_no_error = [](int x) { |
| 142 RTC_DCHECK_EQ(x, AudioProcessing::kNoError); | 147 RTC_DCHECK_EQ(x, AudioProcessing::kNoError); |
| 143 }; | 148 }; |
| 144 auto* const gain_control = limiter->gain_control(); | 149 auto* const gain_control = limiter->gain_control(); |
| 145 check_no_error(gain_control->set_mode(GainControl::kFixedDigital)); | 150 check_no_error(gain_control->set_mode(GainControl::kFixedDigital)); |
| 146 | 151 |
| 147 // We smoothly limit the mixed frame to -7 dbFS. -6 would correspond to the | 152 // We smoothly limit the mixed frame to -7 dbFS. -6 would correspond to the |
| 148 // divide-by-2 but -7 is used instead to give a bit of headroom since the | 153 // divide-by-2 but -7 is used instead to give a bit of headroom since the |
| 149 // AGC is not a hard limiter. | 154 // AGC is not a hard limiter. |
| 150 check_no_error(gain_control->set_target_level_dbfs(7)); | 155 check_no_error(gain_control->set_target_level_dbfs(7)); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 std::vector<rtc::ArrayView<const int16_t>> input_frames; | 206 std::vector<rtc::ArrayView<const int16_t>> input_frames; |
| 202 for (size_t i = 0; i < mix_list.size(); ++i) { | 207 for (size_t i = 0; i < mix_list.size(); ++i) { |
| 203 input_frames.push_back(rtc::ArrayView<const int16_t>( | 208 input_frames.push_back(rtc::ArrayView<const int16_t>( |
| 204 mix_list[i]->data_, samples_per_channel * number_of_channels)); | 209 mix_list[i]->data_, samples_per_channel * number_of_channels)); |
| 205 } | 210 } |
| 206 CombineMultipleFrames(input_frames, use_limiter_this_round, limiter_.get(), | 211 CombineMultipleFrames(input_frames, use_limiter_this_round, limiter_.get(), |
| 207 audio_frame_for_mixing); | 212 audio_frame_for_mixing); |
| 208 } | 213 } |
| 209 } | 214 } |
| 210 } // namespace webrtc | 215 } // namespace webrtc |
| OLD | NEW |