Adding initial support for lock-less informing of muting
This CL adds the initial support for letting APM know when its output
will be used or not.
It also adds a new method for passing RuntimeInformation to APM that
returns a bool indicating the success of the passing of information.
Bug: b/177830919
Change-Id: Ic2e1b92c37241d74ca6394b785b91736ca7532aa
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206061
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33201}
diff --git a/modules/audio_processing/audio_processing_impl.h b/modules/audio_processing/audio_processing_impl.h
index 3dc13bd..23028ec 100644
--- a/modules/audio_processing/audio_processing_impl.h
+++ b/modules/audio_processing/audio_processing_impl.h
@@ -82,6 +82,7 @@
void AttachAecDump(std::unique_ptr<AecDump> aec_dump) override;
void DetachAecDump() override;
void SetRuntimeSetting(RuntimeSetting setting) override;
+ bool PostRuntimeSetting(RuntimeSetting setting) override;
// Capture-side exclusive methods possibly running APM in a
// multi-threaded manner. Acquire the capture lock.
@@ -96,6 +97,8 @@
bool GetLinearAecOutput(
rtc::ArrayView<std::array<float, 160>> linear_output) const override;
void set_output_will_be_muted(bool muted) override;
+ void HandleCaptureOutputUsedSetting(bool capture_output_used)
+ RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_capture_);
int set_stream_delay_ms(int delay) override;
void set_stream_key_pressed(bool key_pressed) override;
void set_stream_analog_level(int level) override;
@@ -166,7 +169,9 @@
explicit RuntimeSettingEnqueuer(
SwapQueue<RuntimeSetting>* runtime_settings);
~RuntimeSettingEnqueuer();
- void Enqueue(RuntimeSetting setting);
+
+ // Enqueue setting and return whether the setting was successfully enqueued.
+ bool Enqueue(RuntimeSetting setting);
private:
SwapQueue<RuntimeSetting>& runtime_settings_;
@@ -421,7 +426,7 @@
ApmCaptureState();
~ApmCaptureState();
bool was_stream_delay_set;
- bool output_will_be_muted;
+ bool capture_output_used;
bool key_pressed;
std::unique_ptr<AudioBuffer> capture_audio;
std::unique_ptr<AudioBuffer> capture_fullband_audio;