OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
| 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 explicit EchoRemoverImpl(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(int sample_rate_hz) |
| 44 : sample_rate_hz_(sample_rate_hz) { |
| 45 RTC_DCHECK(sample_rate_hz == 8000 || sample_rate_hz == 16000 || |
| 46 sample_rate_hz == 32000 || sample_rate_hz == 48000); |
| 47 } |
| 48 |
| 49 EchoRemoverImpl::~EchoRemoverImpl() = default; |
| 50 |
| 51 // TODO(peah): Add functionality. |
| 52 void EchoRemoverImpl::ProcessBlock( |
| 53 const rtc::Optional<size_t>& echo_path_delay_samples, |
| 54 const EchoPathVariability& echo_path_variability, |
| 55 bool capture_signal_saturation, |
| 56 const std::vector<std::vector<float>>& render, |
| 57 std::vector<std::vector<float>>* capture) { |
| 58 RTC_DCHECK(capture); |
| 59 RTC_DCHECK_EQ(render.size(), NumBandsForRate(sample_rate_hz_)); |
| 60 RTC_DCHECK_EQ(capture->size(), NumBandsForRate(sample_rate_hz_)); |
| 61 RTC_DCHECK_EQ(render[0].size(), kBlockSize); |
| 62 RTC_DCHECK_EQ((*capture)[0].size(), kBlockSize); |
| 63 } |
| 64 |
| 65 // TODO(peah): Add functionality. |
| 66 void EchoRemoverImpl::UpdateEchoLeakageStatus(bool leakage_detected) {} |
| 67 |
| 68 } // namespace |
| 69 |
| 70 EchoRemover* EchoRemover::Create(int sample_rate_hz) { |
| 71 return new EchoRemoverImpl(sample_rate_hz); |
| 72 } |
| 73 |
| 74 } // namespace webrtc |
OLD | NEW |