Remove the HighPassFilter interface
The functionality remains unaffected. Filter toggling is still available via webrtc::AudioProcessing::Config. Example: webrtc::AudioProcessing::Config config = apm.GetConfig(); // Read settings if (config.high_pass_filter.enabled) { ... } // Apply setting config.high_pass_filter.enabled = true; apm.ApplyConfig(); Bug: webrtc:9535 Change-Id: Ib4c4b04078bbb490ebdab9721b8c7811d73777a8 Reviewed-on: https://webrtc-review.googlesource.com/c/102541 Commit-Queue: Sam Zackrisson <saza@webrtc.org> Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org> Reviewed-by: Per Åhgren <peah@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25198}
This commit is contained in:

committed by
Commit Bot

parent
d419db9a9e
commit
e2405c1a82
@ -164,11 +164,4 @@ TEST(ApmHelpersTest, TypingDetectionStatus_EnableDisable) {
|
|||||||
EXPECT_EQ(VoiceDetection::kVeryLowLikelihood, vd->likelihood());
|
EXPECT_EQ(VoiceDetection::kVeryLowLikelihood, vd->likelihood());
|
||||||
EXPECT_FALSE(vd->is_enabled());
|
EXPECT_FALSE(vd->is_enabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(solenberg): Move this test to a better place - added here for the sake
|
|
||||||
// of duplicating all relevant tests from audio_processing_test.cc.
|
|
||||||
TEST(ApmHelpersTest, HighPassFilter_DefaultMode) {
|
|
||||||
TestHelper helper;
|
|
||||||
EXPECT_FALSE(helper.apm()->high_pass_filter()->is_enabled());
|
|
||||||
}
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
@ -115,29 +115,6 @@ static const size_t kMaxAllowedValuesOfSamplesPerFrame = 480;
|
|||||||
// TODO(peah): Decrease this once we properly handle hugely unbalanced
|
// TODO(peah): Decrease this once we properly handle hugely unbalanced
|
||||||
// reverse and forward call numbers.
|
// reverse and forward call numbers.
|
||||||
static const size_t kMaxNumFramesToBuffer = 100;
|
static const size_t kMaxNumFramesToBuffer = 100;
|
||||||
|
|
||||||
class HighPassFilterImpl : public HighPassFilter {
|
|
||||||
public:
|
|
||||||
explicit HighPassFilterImpl(AudioProcessingImpl* apm) : apm_(apm) {}
|
|
||||||
~HighPassFilterImpl() override = default;
|
|
||||||
|
|
||||||
// HighPassFilter implementation.
|
|
||||||
int Enable(bool enable) override {
|
|
||||||
apm_->MutateConfig([enable](AudioProcessing::Config* config) {
|
|
||||||
config->high_pass_filter.enabled = enable;
|
|
||||||
});
|
|
||||||
|
|
||||||
return AudioProcessing::kNoError;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool is_enabled() const override {
|
|
||||||
return apm_->GetConfig().high_pass_filter.enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
AudioProcessingImpl* apm_;
|
|
||||||
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(HighPassFilterImpl);
|
|
||||||
};
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
// Throughout webrtc, it's assumed that success is represented by zero.
|
// Throughout webrtc, it's assumed that success is represented by zero.
|
||||||
@ -352,7 +329,6 @@ AudioProcessingImpl::AudioProcessingImpl(
|
|||||||
render_runtime_settings_(kRuntimeSettingQueueSize),
|
render_runtime_settings_(kRuntimeSettingQueueSize),
|
||||||
capture_runtime_settings_enqueuer_(&capture_runtime_settings_),
|
capture_runtime_settings_enqueuer_(&capture_runtime_settings_),
|
||||||
render_runtime_settings_enqueuer_(&render_runtime_settings_),
|
render_runtime_settings_enqueuer_(&render_runtime_settings_),
|
||||||
high_pass_filter_impl_(new HighPassFilterImpl(this)),
|
|
||||||
echo_control_factory_(std::move(echo_control_factory)),
|
echo_control_factory_(std::move(echo_control_factory)),
|
||||||
submodule_states_(!!capture_post_processor,
|
submodule_states_(!!capture_post_processor,
|
||||||
!!render_pre_processor,
|
!!render_pre_processor,
|
||||||
@ -1727,10 +1703,6 @@ GainControl* AudioProcessingImpl::gain_control() const {
|
|||||||
return public_submodules_->gain_control.get();
|
return public_submodules_->gain_control.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
HighPassFilter* AudioProcessingImpl::high_pass_filter() const {
|
|
||||||
return high_pass_filter_impl_.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
LevelEstimator* AudioProcessingImpl::level_estimator() const {
|
LevelEstimator* AudioProcessingImpl::level_estimator() const {
|
||||||
return public_submodules_->level_estimator.get();
|
return public_submodules_->level_estimator.get();
|
||||||
}
|
}
|
||||||
|
@ -118,8 +118,6 @@ class AudioProcessingImpl : public AudioProcessing {
|
|||||||
// created only once in a single-treaded manner
|
// created only once in a single-treaded manner
|
||||||
// during APM creation).
|
// during APM creation).
|
||||||
GainControl* gain_control() const override;
|
GainControl* gain_control() const override;
|
||||||
// TODO(peah): Deprecate this API call.
|
|
||||||
HighPassFilter* high_pass_filter() const override;
|
|
||||||
LevelEstimator* level_estimator() const override;
|
LevelEstimator* level_estimator() const override;
|
||||||
NoiseSuppression* noise_suppression() const override;
|
NoiseSuppression* noise_suppression() const override;
|
||||||
VoiceDetection* voice_detection() const override;
|
VoiceDetection* voice_detection() const override;
|
||||||
@ -164,9 +162,6 @@ class AudioProcessingImpl : public AudioProcessing {
|
|||||||
RuntimeSettingEnqueuer capture_runtime_settings_enqueuer_;
|
RuntimeSettingEnqueuer capture_runtime_settings_enqueuer_;
|
||||||
RuntimeSettingEnqueuer render_runtime_settings_enqueuer_;
|
RuntimeSettingEnqueuer render_runtime_settings_enqueuer_;
|
||||||
|
|
||||||
// Submodule interface implementations.
|
|
||||||
std::unique_ptr<HighPassFilter> high_pass_filter_impl_;
|
|
||||||
|
|
||||||
// EchoControl factory.
|
// EchoControl factory.
|
||||||
std::unique_ptr<EchoControlFactory> echo_control_factory_;
|
std::unique_ptr<EchoControlFactory> echo_control_factory_;
|
||||||
|
|
||||||
|
@ -1278,7 +1278,6 @@ TEST_F(ApmTest, AllProcessingDisabledByDefault) {
|
|||||||
EXPECT_FALSE(config.echo_canceller.enabled);
|
EXPECT_FALSE(config.echo_canceller.enabled);
|
||||||
EXPECT_FALSE(config.high_pass_filter.enabled);
|
EXPECT_FALSE(config.high_pass_filter.enabled);
|
||||||
EXPECT_FALSE(apm_->gain_control()->is_enabled());
|
EXPECT_FALSE(apm_->gain_control()->is_enabled());
|
||||||
EXPECT_FALSE(apm_->high_pass_filter()->is_enabled());
|
|
||||||
EXPECT_FALSE(apm_->level_estimator()->is_enabled());
|
EXPECT_FALSE(apm_->level_estimator()->is_enabled());
|
||||||
EXPECT_FALSE(apm_->noise_suppression()->is_enabled());
|
EXPECT_FALSE(apm_->noise_suppression()->is_enabled());
|
||||||
EXPECT_FALSE(apm_->voice_detection()->is_enabled());
|
EXPECT_FALSE(apm_->voice_detection()->is_enabled());
|
||||||
|
@ -49,7 +49,6 @@ class ProcessingConfig;
|
|||||||
|
|
||||||
class EchoDetector;
|
class EchoDetector;
|
||||||
class GainControl;
|
class GainControl;
|
||||||
class HighPassFilter;
|
|
||||||
class LevelEstimator;
|
class LevelEstimator;
|
||||||
class NoiseSuppression;
|
class NoiseSuppression;
|
||||||
class CustomAudioAnalyzer;
|
class CustomAudioAnalyzer;
|
||||||
@ -598,8 +597,6 @@ class AudioProcessing : public rtc::RefCountInterface {
|
|||||||
// NULL. The pointers will be valid for the lifetime of the APM instance.
|
// NULL. The pointers will be valid for the lifetime of the APM instance.
|
||||||
// The memory for these objects is entirely managed internally.
|
// The memory for these objects is entirely managed internally.
|
||||||
virtual GainControl* gain_control() const = 0;
|
virtual GainControl* gain_control() const = 0;
|
||||||
// TODO(peah): Deprecate this API call.
|
|
||||||
virtual HighPassFilter* high_pass_filter() const = 0;
|
|
||||||
virtual LevelEstimator* level_estimator() const = 0;
|
virtual LevelEstimator* level_estimator() const = 0;
|
||||||
virtual NoiseSuppression* noise_suppression() const = 0;
|
virtual NoiseSuppression* noise_suppression() const = 0;
|
||||||
virtual VoiceDetection* voice_detection() const = 0;
|
virtual VoiceDetection* voice_detection() const = 0;
|
||||||
@ -789,17 +786,6 @@ class ProcessingConfig {
|
|||||||
StreamConfig streams[StreamName::kNumStreamNames];
|
StreamConfig streams[StreamName::kNumStreamNames];
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO(peah): Remove this interface.
|
|
||||||
// A filtering component which removes DC offset and low-frequency noise.
|
|
||||||
// Recommended to be enabled on the client-side.
|
|
||||||
class HighPassFilter {
|
|
||||||
public:
|
|
||||||
virtual int Enable(bool enable) = 0;
|
|
||||||
virtual bool is_enabled() const = 0;
|
|
||||||
|
|
||||||
virtual ~HighPassFilter() {}
|
|
||||||
};
|
|
||||||
|
|
||||||
// An estimation component used to retrieve level metrics.
|
// An estimation component used to retrieve level metrics.
|
||||||
class LevelEstimator {
|
class LevelEstimator {
|
||||||
public:
|
public:
|
||||||
|
@ -42,13 +42,6 @@ class MockGainControl : public GainControl {
|
|||||||
MOCK_CONST_METHOD0(stream_is_saturated, bool());
|
MOCK_CONST_METHOD0(stream_is_saturated, bool());
|
||||||
};
|
};
|
||||||
|
|
||||||
class MockHighPassFilter : public HighPassFilter {
|
|
||||||
public:
|
|
||||||
virtual ~MockHighPassFilter() {}
|
|
||||||
MOCK_METHOD1(Enable, int(bool enable));
|
|
||||||
MOCK_CONST_METHOD0(is_enabled, bool());
|
|
||||||
};
|
|
||||||
|
|
||||||
class MockLevelEstimator : public LevelEstimator {
|
class MockLevelEstimator : public LevelEstimator {
|
||||||
public:
|
public:
|
||||||
virtual ~MockLevelEstimator() {}
|
virtual ~MockLevelEstimator() {}
|
||||||
@ -114,7 +107,6 @@ class MockAudioProcessing : public testing::NiceMock<AudioProcessing> {
|
|||||||
public:
|
public:
|
||||||
MockAudioProcessing()
|
MockAudioProcessing()
|
||||||
: gain_control_(new testing::NiceMock<MockGainControl>()),
|
: gain_control_(new testing::NiceMock<MockGainControl>()),
|
||||||
high_pass_filter_(new testing::NiceMock<MockHighPassFilter>()),
|
|
||||||
level_estimator_(new testing::NiceMock<MockLevelEstimator>()),
|
level_estimator_(new testing::NiceMock<MockLevelEstimator>()),
|
||||||
noise_suppression_(new testing::NiceMock<MockNoiseSuppression>()),
|
noise_suppression_(new testing::NiceMock<MockNoiseSuppression>()),
|
||||||
voice_detection_(new testing::NiceMock<MockVoiceDetection>()) {}
|
voice_detection_(new testing::NiceMock<MockVoiceDetection>()) {}
|
||||||
@ -183,9 +175,6 @@ class MockAudioProcessing : public testing::NiceMock<AudioProcessing> {
|
|||||||
MOCK_CONST_METHOD0(GetStatistics, AudioProcessingStatistics());
|
MOCK_CONST_METHOD0(GetStatistics, AudioProcessingStatistics());
|
||||||
MOCK_CONST_METHOD1(GetStatistics, AudioProcessingStats(bool));
|
MOCK_CONST_METHOD1(GetStatistics, AudioProcessingStats(bool));
|
||||||
virtual MockGainControl* gain_control() const { return gain_control_.get(); }
|
virtual MockGainControl* gain_control() const { return gain_control_.get(); }
|
||||||
virtual MockHighPassFilter* high_pass_filter() const {
|
|
||||||
return high_pass_filter_.get();
|
|
||||||
}
|
|
||||||
virtual MockLevelEstimator* level_estimator() const {
|
virtual MockLevelEstimator* level_estimator() const {
|
||||||
return level_estimator_.get();
|
return level_estimator_.get();
|
||||||
}
|
}
|
||||||
@ -200,7 +189,6 @@ class MockAudioProcessing : public testing::NiceMock<AudioProcessing> {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<MockGainControl> gain_control_;
|
std::unique_ptr<MockGainControl> gain_control_;
|
||||||
std::unique_ptr<MockHighPassFilter> high_pass_filter_;
|
|
||||||
std::unique_ptr<MockLevelEstimator> level_estimator_;
|
std::unique_ptr<MockLevelEstimator> level_estimator_;
|
||||||
std::unique_ptr<MockNoiseSuppression> noise_suppression_;
|
std::unique_ptr<MockNoiseSuppression> noise_suppression_;
|
||||||
std::unique_ptr<MockVoiceDetection> voice_detection_;
|
std::unique_ptr<MockVoiceDetection> voice_detection_;
|
||||||
|
Reference in New Issue
Block a user