Remove unused AEC delay offset API

Bug: webrtc:5298
Change-Id: If490dba3c95b1d6aeaa7b110dd1ffc23ee7a96c9
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/166440
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30297}
This commit is contained in:
Sam Zackrisson
2020-01-17 10:55:09 +01:00
committed by Commit Bot
parent a3d4252a01
commit 2d31aea481
5 changed files with 3 additions and 63 deletions

View File

@ -1235,7 +1235,7 @@ int AudioProcessingImpl::ProcessCaptureStreamLocked() {
if (submodules_.echo_control_mobile) {
// Ensure that the stream delay was set before the call to the
// AECM ProcessCaptureAudio function.
if (!was_stream_delay_set()) {
if (!capture_.was_stream_delay_set) {
return AudioProcessing::kStreamParameterNotSetError;
}
@ -1252,7 +1252,7 @@ int AudioProcessingImpl::ProcessCaptureStreamLocked() {
if (submodules_.echo_controller) {
data_dumper_->DumpRaw("stream_delay", stream_delay_ms());
if (was_stream_delay_set()) {
if (capture_.was_stream_delay_set) {
submodules_.echo_controller->SetAudioBufferDelay(stream_delay_ms());
}
@ -1553,7 +1553,6 @@ int AudioProcessingImpl::set_stream_delay_ms(int delay) {
rtc::CritScope cs(&crit_capture_);
Error retval = kNoError;
capture_.was_stream_delay_set = true;
delay += capture_.delay_offset_ms;
if (delay < 0) {
delay = 0;
@ -1600,26 +1599,11 @@ int AudioProcessingImpl::stream_delay_ms() const {
return capture_nonlocked_.stream_delay_ms;
}
bool AudioProcessingImpl::was_stream_delay_set() const {
// Used as callback from submodules, hence locking is not allowed.
return capture_.was_stream_delay_set;
}
void AudioProcessingImpl::set_stream_key_pressed(bool key_pressed) {
rtc::CritScope cs(&crit_capture_);
capture_.key_pressed = key_pressed;
}
void AudioProcessingImpl::set_delay_offset_ms(int offset) {
rtc::CritScope cs(&crit_capture_);
capture_.delay_offset_ms = offset;
}
int AudioProcessingImpl::delay_offset_ms() const {
rtc::CritScope cs(&crit_capture_);
return capture_.delay_offset_ms;
}
void AudioProcessingImpl::set_stream_analog_level(int level) {
rtc::CritScope cs_capture(&crit_capture_);
@ -2107,8 +2091,7 @@ void AudioProcessingImpl::RecordAudioProcessingState() {
}
AudioProcessingImpl::ApmCaptureState::ApmCaptureState()
: delay_offset_ms(0),
was_stream_delay_set(false),
: was_stream_delay_set(false),
output_will_be_muted(false),
key_pressed(false),
capture_processing_format(kSampleRate16kHz),

View File

@ -89,8 +89,6 @@ class AudioProcessingImpl : public AudioProcessing {
rtc::ArrayView<std::array<float, 160>> linear_output) const override;
void set_output_will_be_muted(bool muted) override;
int set_stream_delay_ms(int delay) override;
void set_delay_offset_ms(int offset) override;
int delay_offset_ms() const override;
void set_stream_key_pressed(bool key_pressed) override;
void set_stream_analog_level(int level) override;
int recommended_stream_analog_level() const override;
@ -115,8 +113,6 @@ class AudioProcessingImpl : public AudioProcessing {
size_t num_output_channels() const override;
size_t num_reverse_channels() const override;
int stream_delay_ms() const override;
bool was_stream_delay_set() const override
RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_capture_);
AudioProcessingStats GetStatistics(bool has_remote_tracks) override {
return GetStatistics();
@ -394,7 +390,6 @@ class AudioProcessingImpl : public AudioProcessing {
struct ApmCaptureState {
ApmCaptureState();
~ApmCaptureState();
int delay_offset_ms;
bool was_stream_delay_set;
bool output_will_be_muted;
bool key_pressed;

View File

@ -816,15 +816,10 @@ void CaptureProcessor::ApplyRuntimeSettingScheme() {
ASSERT_EQ(AudioProcessing::Error::kNoError,
apm_->set_stream_delay_ms(30));
apm_->set_stream_key_pressed(true);
apm_->set_delay_offset_ms(15);
EXPECT_EQ(apm_->delay_offset_ms(), 15);
} else {
ASSERT_EQ(AudioProcessing::Error::kNoError,
apm_->set_stream_delay_ms(50));
apm_->set_stream_key_pressed(false);
apm_->set_delay_offset_ms(20);
EXPECT_EQ(apm_->delay_offset_ms(), 20);
apm_->delay_offset_ms();
}
break;
default:

View File

@ -732,30 +732,6 @@ TEST_F(ApmTest, StreamParametersFloat) {
StreamParametersTest(kFloatFormat);
}
TEST_F(ApmTest, DefaultDelayOffsetIsZero) {
EXPECT_EQ(0, apm_->delay_offset_ms());
EXPECT_EQ(apm_->kNoError, apm_->set_stream_delay_ms(50));
EXPECT_EQ(50, apm_->stream_delay_ms());
}
TEST_F(ApmTest, DelayOffsetWithLimitsIsSetProperly) {
// High limit of 500 ms.
apm_->set_delay_offset_ms(100);
EXPECT_EQ(100, apm_->delay_offset_ms());
EXPECT_EQ(apm_->kBadStreamParameterWarning, apm_->set_stream_delay_ms(450));
EXPECT_EQ(500, apm_->stream_delay_ms());
EXPECT_EQ(apm_->kNoError, apm_->set_stream_delay_ms(100));
EXPECT_EQ(200, apm_->stream_delay_ms());
// Low limit of 0 ms.
apm_->set_delay_offset_ms(-50);
EXPECT_EQ(-50, apm_->delay_offset_ms());
EXPECT_EQ(apm_->kBadStreamParameterWarning, apm_->set_stream_delay_ms(20));
EXPECT_EQ(0, apm_->stream_delay_ms());
EXPECT_EQ(apm_->kNoError, apm_->set_stream_delay_ms(100));
EXPECT_EQ(50, apm_->stream_delay_ms());
}
void ApmTest::TestChangingChannelsInt16Interface(
size_t num_channels,
AudioProcessing::Error expected_return) {

View File

@ -611,20 +611,11 @@ class RTC_EXPORT AudioProcessing : public rtc::RefCountInterface {
// ProcessStream().
virtual int set_stream_delay_ms(int delay) = 0;
virtual int stream_delay_ms() const = 0;
virtual bool was_stream_delay_set() const = 0;
// Call to signal that a key press occurred (true) or did not occur (false)
// with this chunk of audio.
virtual void set_stream_key_pressed(bool key_pressed) = 0;
// Sets a delay |offset| in ms to add to the values passed in through
// set_stream_delay_ms(). May be positive or negative.
//
// Note that this could cause an otherwise valid value passed to
// set_stream_delay_ms() to return an error.
virtual void set_delay_offset_ms(int offset) = 0;
virtual int delay_offset_ms() const = 0;
// Attaches provided webrtc::AecDump for recording debugging
// information. Log file and maximum file size logic is supposed to
// be handled by implementing instance of AecDump. Calling this