Reland "Correct AEC3 multichannel functionality activation"
This is a reland of 9dda1b3a484ebeef921e419406402039f3852427 Original change's description: > Correct AEC3 multichannel functionality activation > > This CL corrects the AEC3 multichannel activation > to also work for the case when a factory is used > for the activation. > > Bug: webrtc:10913 > Change-Id: Ic2807d8bcef759261fde14447cff30633ba248dc > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/158794 > Commit-Queue: Per Åhgren <peah@webrtc.org> > Reviewed-by: Sam Zackrisson <saza@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#29676} Bug: webrtc:10913 Change-Id: I1cb3d0de61ea0b299158ca85433f2442c65c196f Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/158886 Reviewed-by: Sam Zackrisson <saza@webrtc.org> Commit-Queue: Per Åhgren <peah@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29690}
This commit is contained in:
parent
4c04d8e10c
commit
4e5c709ed4
@ -89,4 +89,7 @@ rtc_source_set("echo_control") {
|
|||||||
sources = [
|
sources = [
|
||||||
"echo_control.h",
|
"echo_control.h",
|
||||||
]
|
]
|
||||||
|
deps = [
|
||||||
|
"../../rtc_base:checks",
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,9 +21,16 @@ EchoCanceller3Factory::EchoCanceller3Factory(const EchoCanceller3Config& config)
|
|||||||
: config_(config) {}
|
: config_(config) {}
|
||||||
|
|
||||||
std::unique_ptr<EchoControl> EchoCanceller3Factory::Create(int sample_rate_hz) {
|
std::unique_ptr<EchoControl> EchoCanceller3Factory::Create(int sample_rate_hz) {
|
||||||
return std::make_unique<EchoCanceller3>(config_, sample_rate_hz,
|
return Create(sample_rate_hz, /*num_render_channels=*/1,
|
||||||
/*num_render_channels=*/1,
|
/*num_capture_channels=*/1);
|
||||||
/*num_capture_channels=*/1);
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<EchoControl> EchoCanceller3Factory::Create(
|
||||||
|
int sample_rate_hz,
|
||||||
|
int num_render_channels,
|
||||||
|
int num_capture_channels) {
|
||||||
|
return std::make_unique<EchoCanceller3>(
|
||||||
|
config_, sample_rate_hz, num_render_channels, num_capture_channels);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|||||||
@ -29,9 +29,15 @@ class RTC_EXPORT EchoCanceller3Factory : public EchoControlFactory {
|
|||||||
explicit EchoCanceller3Factory(const EchoCanceller3Config& config);
|
explicit EchoCanceller3Factory(const EchoCanceller3Config& config);
|
||||||
|
|
||||||
// Creates an EchoCanceller3 running at the specified sampling rate using a
|
// Creates an EchoCanceller3 running at the specified sampling rate using a
|
||||||
// mono setup
|
// mono setup.
|
||||||
std::unique_ptr<EchoControl> Create(int sample_rate_hz) override;
|
std::unique_ptr<EchoControl> Create(int sample_rate_hz) override;
|
||||||
|
|
||||||
|
// Creates an EchoCanceller3 running at the specified sampling rate using a
|
||||||
|
// multichannel setup.
|
||||||
|
std::unique_ptr<EchoControl> Create(int sample_rate_hz,
|
||||||
|
int num_render_channels,
|
||||||
|
int num_capture_channels) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const EchoCanceller3Config config_;
|
const EchoCanceller3Config config_;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -13,6 +13,8 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#include "rtc_base/checks.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
class AudioBuffer;
|
class AudioBuffer;
|
||||||
@ -51,6 +53,14 @@ class EchoControl {
|
|||||||
class EchoControlFactory {
|
class EchoControlFactory {
|
||||||
public:
|
public:
|
||||||
virtual std::unique_ptr<EchoControl> Create(int sample_rate_hz) = 0;
|
virtual std::unique_ptr<EchoControl> Create(int sample_rate_hz) = 0;
|
||||||
|
// TODO(peah): Make pure virtual.
|
||||||
|
virtual std::unique_ptr<EchoControl> Create(int sample_rate_hz,
|
||||||
|
int num_render_channels,
|
||||||
|
int num_capture_channels) {
|
||||||
|
RTC_NOTREACHED();
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
virtual ~EchoControlFactory() = default;
|
virtual ~EchoControlFactory() = default;
|
||||||
};
|
};
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|||||||
@ -1783,8 +1783,8 @@ void AudioProcessingImpl::InitializeEchoController() {
|
|||||||
if (use_echo_controller) {
|
if (use_echo_controller) {
|
||||||
// Create and activate the echo controller.
|
// Create and activate the echo controller.
|
||||||
if (echo_control_factory_) {
|
if (echo_control_factory_) {
|
||||||
submodules_.echo_controller =
|
submodules_.echo_controller = echo_control_factory_->Create(
|
||||||
echo_control_factory_->Create(proc_sample_rate_hz());
|
proc_sample_rate_hz(), num_reverse_channels(), num_proc_channels());
|
||||||
} else {
|
} else {
|
||||||
submodules_.echo_controller = std::make_unique<EchoCanceller3>(
|
submodules_.echo_controller = std::make_unique<EchoCanceller3>(
|
||||||
EchoCanceller3Config(), proc_sample_rate_hz(), num_reverse_channels(),
|
EchoCanceller3Config(), proc_sample_rate_hz(), num_reverse_channels(),
|
||||||
|
|||||||
@ -54,6 +54,12 @@ class MockEchoControlFactory : public EchoControlFactory {
|
|||||||
// Returns a pointer to the next MockEchoControl that this factory creates.
|
// Returns a pointer to the next MockEchoControl that this factory creates.
|
||||||
MockEchoControl* GetNext() const { return next_mock_.get(); }
|
MockEchoControl* GetNext() const { return next_mock_.get(); }
|
||||||
std::unique_ptr<EchoControl> Create(int sample_rate_hz) override {
|
std::unique_ptr<EchoControl> Create(int sample_rate_hz) override {
|
||||||
|
RTC_NOTREACHED();
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
std::unique_ptr<EchoControl> Create(int sample_rate_hz,
|
||||||
|
int num_render_channels,
|
||||||
|
int num_capture_channels) override {
|
||||||
std::unique_ptr<EchoControl> mock = std::move(next_mock_);
|
std::unique_ptr<EchoControl> mock = std::move(next_mock_);
|
||||||
next_mock_ = std::make_unique<MockEchoControl>();
|
next_mock_ = std::make_unique<MockEchoControl>();
|
||||||
return mock;
|
return mock;
|
||||||
|
|||||||
@ -2430,8 +2430,8 @@ class MyEchoControlFactory : public EchoControlFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<EchoControl> Create(int sample_rate_hz,
|
std::unique_ptr<EchoControl> Create(int sample_rate_hz,
|
||||||
size_t num_render_channels,
|
int num_render_channels,
|
||||||
size_t num_capture_channels) {
|
int num_capture_channels) {
|
||||||
return Create(sample_rate_hz);
|
return Create(sample_rate_hz);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user