Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(383)

Unified Diff: webrtc/modules/audio_processing/audio_processing_impl.cc

Issue 1867483003: Partial revert of "Don't always downsample to 16kHz in the reverse stream in APM" (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_processing/audio_processing_impl.cc
diff --git a/webrtc/modules/audio_processing/audio_processing_impl.cc b/webrtc/modules/audio_processing/audio_processing_impl.cc
index 9fd18fcb65eb1341071c3fdba527025ae737aea7..953b6996ccf526955edc45efb53057bdda306416 100644
--- a/webrtc/modules/audio_processing/audio_processing_impl.cc
+++ b/webrtc/modules/audio_processing/audio_processing_impl.cc
@@ -366,15 +366,18 @@ int AudioProcessingImpl::InitializeLocked(const ProcessingConfig& config) {
formats_.api_format.input_stream().sample_rate_hz(),
formats_.api_format.output_stream().sample_rate_hz())));
- int rev_proc_rate = ClosestNativeRate(std::min(
the sun 2016/04/06 09:34:57 nit: ClosestNativeRate() should be renamed btw, si
peah-webrtc 2016/04/06 09:36:31 True. Good point! Ok if I address that in another
- formats_.api_format.reverse_input_stream().sample_rate_hz(),
- formats_.api_format.reverse_output_stream().sample_rate_hz()));
- // If the forward sample rate is 8 kHz, the reverse stream is also processed
- // at this rate.
+ // We normally process the reverse stream at 16 kHz. Unless...
+ int rev_proc_rate = kSampleRate16kHz;
if (capture_nonlocked_.fwd_proc_format.sample_rate_hz() == kSampleRate8kHz) {
+ // ...the forward stream is at 8 kHz.
rev_proc_rate = kSampleRate8kHz;
} else {
- rev_proc_rate = std::max(rev_proc_rate, static_cast<int>(kSampleRate16kHz));
+ if (formats_.api_format.reverse_input_stream().sample_rate_hz() ==
+ kSampleRate32kHz) {
+ // ...or the input is at 32 kHz, in which case we use the splitting
+ // filter rather than the resampler.
+ rev_proc_rate = kSampleRate32kHz;
+ }
}
// Always downmix the reverse stream to mono for analysis. This has been
@@ -1148,11 +1151,11 @@ bool AudioProcessingImpl::is_rev_processed() const {
bool AudioProcessingImpl::rev_synthesis_needed() const {
return (is_rev_processed() &&
- is_multi_band(formats_.rev_proc_format.sample_rate_hz()));
+ formats_.rev_proc_format.sample_rate_hz() == kSampleRate32kHz);
}
bool AudioProcessingImpl::rev_analysis_needed() const {
- return is_multi_band(formats_.rev_proc_format.sample_rate_hz()) &&
+ return formats_.rev_proc_format.sample_rate_hz() == kSampleRate32kHz &&
(is_rev_processed() ||
public_submodules_->echo_cancellation->is_enabled() ||
public_submodules_->echo_control_mobile->is_enabled() ||
« no previous file with comments | « data/audio_processing/output_data_mac.pb ('k') | webrtc/modules/audio_processing/test/audio_processing_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698