Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | |
|
hlundin-webrtc
2017/01/18 13:08:49
2017
peah-webrtc
2017/01/19 15:33:05
Done.
| |
| 3 * | |
| 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 | |
| 6 * tree. An additional intellectual property rights grant can be found | |
| 7 * in the file PATENTS. All contributing project authors may | |
| 8 * be found in the AUTHORS file in the root of the source tree. | |
| 9 */ | |
| 10 #include "webrtc/modules/audio_processing/aec3/echo_remover.h" | |
| 11 | |
| 12 #include <algorithm> | |
| 13 #include <vector> | |
| 14 | |
| 15 #include "webrtc/base/constructormagic.h" | |
| 16 #include "webrtc/base/checks.h" | |
| 17 #include "webrtc/base/optional.h" | |
| 18 #include "webrtc/modules/audio_processing/aec3/aec3_constants.h" | |
| 19 | |
| 20 namespace webrtc { | |
| 21 | |
| 22 namespace { | |
| 23 class EchoRemoverImpl final : public EchoRemover { | |
| 24 public: | |
| 25 EchoRemoverImpl(ApmDataDumper* data_dumper, int sample_rate_hz); | |
| 26 ~EchoRemoverImpl() override; | |
| 27 | |
| 28 void ProcessBlock(const rtc::Optional<size_t>& echo_path_delay_samples, | |
| 29 const EchoPathVariability& echo_path_variability, | |
| 30 bool capture_signal_saturation, | |
| 31 const std::vector<std::vector<float>>& render, | |
| 32 std::vector<std::vector<float>>* capture) override; | |
| 33 | |
| 34 void UpdateEchoLeakageStatus(bool leakage_detected) override; | |
| 35 | |
| 36 private: | |
| 37 const int sample_rate_hz_; | |
| 38 | |
| 39 RTC_DISALLOW_COPY_AND_ASSIGN(EchoRemoverImpl); | |
| 40 }; | |
| 41 | |
| 42 // TODO(peah): Add functionality. | |
| 43 EchoRemoverImpl::EchoRemoverImpl(ApmDataDumper* data_dumper, int sample_rate_hz) | |
| 44 : sample_rate_hz_(sample_rate_hz) { | |
| 45 RTC_DCHECK(data_dumper); | |
| 46 RTC_DCHECK(sample_rate_hz == 8000 || sample_rate_hz == 16000 || | |
| 47 sample_rate_hz == 32000 || sample_rate_hz == 48000); | |
| 48 } | |
| 49 | |
| 50 EchoRemoverImpl::~EchoRemoverImpl() = default; | |
| 51 | |
| 52 // TODO(peah): Add functionality. | |
| 53 void EchoRemoverImpl::ProcessBlock( | |
| 54 const rtc::Optional<size_t>& echo_path_delay_samples, | |
| 55 const EchoPathVariability& echo_path_variability, | |
| 56 bool capture_signal_saturation, | |
| 57 const std::vector<std::vector<float>>& render, | |
| 58 std::vector<std::vector<float>>* capture) { | |
| 59 RTC_DCHECK(capture); | |
| 60 RTC_DCHECK_EQ(render.size(), NumBandsForRate(sample_rate_hz_)); | |
| 61 RTC_DCHECK_EQ(capture->size(), NumBandsForRate(sample_rate_hz_)); | |
| 62 RTC_DCHECK_EQ(render[0].size(), kBlockSize); | |
| 63 RTC_DCHECK_EQ((*capture)[0].size(), kBlockSize); | |
| 64 } | |
| 65 | |
| 66 // TODO(peah): Add functionality. | |
| 67 void EchoRemoverImpl::UpdateEchoLeakageStatus(bool leakage_detected) {} | |
| 68 | |
| 69 } // namespace | |
| 70 | |
| 71 EchoRemover* EchoRemover::Create(ApmDataDumper* data_dumper, | |
| 72 int sample_rate_hz) { | |
| 73 return new EchoRemoverImpl(data_dumper, sample_rate_hz); | |
| 74 } | |
| 75 | |
| 76 } // namespace webrtc | |
| OLD | NEW |