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

Unified Diff: webrtc/voice_engine/utility.cc

Issue 1338833002: Fix the maximum native sample rate in AudioProcessing (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix 44k1 sample rate Created 5 years, 3 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/voice_engine/utility.cc
diff --git a/webrtc/voice_engine/utility.cc b/webrtc/voice_engine/utility.cc
index 82ef076d41b01d70af7a60f55d4d22d2c2baaf41..6d5093456307ce5b5d743a8ea13ee88a5fbe0abe 100644
--- a/webrtc/voice_engine/utility.cc
+++ b/webrtc/voice_engine/utility.cc
@@ -85,9 +85,16 @@ void DownConvertToCodecFormat(const int16_t* src_data,
assert(codec_num_channels == 1 || codec_num_channels == 2);
dst_af->Reset();
- // Never upsample the capture signal here. This should be done at the
- // end of the send chain.
- int destination_rate = std::min(codec_rate_hz, sample_rate_hz);
+ // Chose the lowest native sample rate which is higher or equal than at least
+ // one of the input or codec rates.
+ int destination_rate;
Andrew MacDonald 2015/09/16 02:35:08 I think you should move this to transmit_mixer.cc
aluebs-webrtc 2015/09/16 03:02:53 What do you mean with "do the whole thing" in one
Andrew MacDonald 2015/09/16 04:04:08 Mainly, I don't like that both DownConvertToCodecF
aluebs-webrtc 2015/09/22 01:35:29 Agreed. I didn't move it to the float interface, s
Andrew MacDonald 2015/09/23 02:35:52 What you have looks good. Thanks for the cleanup.
+ for (size_t i = 0; i < kNumAudioProcNativeSampleRates; ++i) {
hlundin-webrtc 2015/09/16 13:45:49 Nit: You can use a C++11 range-based for loop here
aluebs-webrtc 2015/09/22 01:35:29 Since now it is defined in the header and declared
+ destination_rate = kAudioProcNativeSampleRatesHz[i];
+ if (destination_rate >= sample_rate_hz ||
+ destination_rate >= codec_rate_hz) {
+ break;
+ }
+ }
// If no stereo codecs are in use, we downmix a stereo stream from the
// device early in the chain, before resampling.

Powered by Google App Engine
This is Rietveld 408576698