Add RuntimeSettings to CustomProcessing.
CustomProcessing is the interface to injectable audio processing
submodules to AudioProcessing. This CL makes it possible to set
runtime settings on the injected render processing component.
Note that the current runtime setting handling happens on the capture
thread. Therefore, we add another SwapQueue to communicate with the
render thread.
Bug: webrtc:9138, webrtc:9262
Change-Id: I665ce2d83a2b35ca8b25cca813d2cef7bd0ba911
Reviewed-on: https://webrtc-review.googlesource.com/76123
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23236}
diff --git a/modules/audio_processing/include/audio_processing.h b/modules/audio_processing/include/audio_processing.h
index 379a664..6162199 100644
--- a/modules/audio_processing/include/audio_processing.h
+++ b/modules/audio_processing/include/audio_processing.h
@@ -313,7 +313,11 @@
// runtime.
class RuntimeSetting {
public:
- enum class Type { kNotSpecified, kCapturePreGain };
+ enum class Type {
+ kNotSpecified,
+ kCapturePreGain,
+ kCustomRenderProcessingRuntimeSetting
+ };
RuntimeSetting() : type_(Type::kNotSpecified), value_(0.f) {}
~RuntimeSetting() = default;
@@ -323,6 +327,10 @@
return {Type::kCapturePreGain, gain};
}
+ static RuntimeSetting CreateCustomRenderSetting(float payload) {
+ return {Type::kCustomRenderProcessingRuntimeSetting, payload};
+ }
+
Type type() const { return type_; }
void GetFloat(float* value) const {
RTC_DCHECK(value);
@@ -1119,6 +1127,9 @@
virtual void Process(AudioBuffer* audio) = 0;
// Returns a string representation of the module state.
virtual std::string ToString() const = 0;
+ // Handles RuntimeSettings. TODO(webrtc:9262): make pure virtual
+ // after updating dependencies.
+ virtual void SetRuntimeSetting(AudioProcessing::RuntimeSetting setting);
virtual ~CustomProcessing() {}
};