APM: Signal error on unsupported sample rates
This CL adds more explicit tests for unsupported sample rates in the WebRTC audio processing module (APM). Rates are restricted to the range [8000, 384000] Hz. Rates outside this range are handled as best as possible, depending on the format.
Tested: bitexact on a large number of aecdumps
Bug: chromium:1332484, chromium:1334991
Change-Id: I9639d03dc837e1fdff64d1f9d1fff0edc0fb299f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/276920
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Per Ã…hgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38663}
diff --git a/modules/audio_processing/audio_processing_impl.h b/modules/audio_processing/audio_processing_impl.h
index 5daea90..191a3ee 100644
--- a/modules/audio_processing/audio_processing_impl.h
+++ b/modules/audio_processing/audio_processing_impl.h
@@ -248,12 +248,13 @@
// capture thread blocks the render thread.
// Called by render: Holds the render lock when reading the format struct and
// acquires both locks if reinitialization is required.
- int MaybeInitializeRender(const ProcessingConfig& processing_config)
+ void MaybeInitializeRender(const StreamConfig& input_config,
+ const StreamConfig& output_config)
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_render_);
- // Called by capture: Holds the capture lock when reading the format struct
- // and acquires both locks if reinitialization is needed.
- int MaybeInitializeCapture(const StreamConfig& input_config,
- const StreamConfig& output_config);
+ // Called by capture: Acquires and releases the capture lock to read the
+ // format struct and acquires both locks if reinitialization is needed.
+ void MaybeInitializeCapture(const StreamConfig& input_config,
+ const StreamConfig& output_config);
// Method for updating the state keeping track of the active submodules.
// Returns a bool indicating whether the state has changed.
@@ -262,7 +263,7 @@
// Methods requiring APM running in a single-threaded manner, requiring both
// the render and capture lock to be acquired.
- int InitializeLocked(const ProcessingConfig& config)
+ void InitializeLocked(const ProcessingConfig& config)
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_render_, mutex_capture_);
void InitializeResidualEchoDetector()
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_render_, mutex_capture_);
@@ -321,7 +322,6 @@
// Render-side exclusive methods possibly running APM in a multi-threaded
// manner that are called with the render lock already acquired.
- // TODO(ekm): Remove once all clients updated to new interface.
int AnalyzeReverseStreamLocked(const float* const* src,
const StreamConfig& input_config,
const StreamConfig& output_config)