Index: webrtc/voice_engine/transmit_mixer.cc |
diff --git a/webrtc/voice_engine/transmit_mixer.cc b/webrtc/voice_engine/transmit_mixer.cc |
index a02f298509fc521845f8ae602c0886dedaefb620..d6eb6b5f192c716ebb7a9499dada2a2faa0b8bc7 100644 |
--- a/webrtc/voice_engine/transmit_mixer.cc |
+++ b/webrtc/voice_engine/transmit_mixer.cc |
@@ -1136,11 +1136,7 @@ void TransmitMixer::GenerateAudioFrame(const int16_t* audio, |
int codec_rate; |
int num_codec_channels; |
GetSendCodecInfo(&codec_rate, &num_codec_channels); |
- // TODO(ajm): This currently restricts the sample rate to 32 kHz. |
- // See: https://code.google.com/p/webrtc/issues/detail?id=3146 |
- // When 48 kHz is supported natively by AudioProcessing, this will have |
- // to be changed to handle 44.1 kHz. |
- int max_sample_rate_hz = kAudioProcMaxNativeSampleRateHz; |
+ int max_sample_rate_hz = AudioProcessing::kMaxNativeSampleRateHz; |
if (audioproc_->echo_control_mobile()->is_enabled()) { |
// AECM only supports 8 and 16 kHz. |
max_sample_rate_hz = 16000; |
@@ -1148,19 +1144,18 @@ void TransmitMixer::GenerateAudioFrame(const int16_t* audio, |
codec_rate = std::min(codec_rate, max_sample_rate_hz); |
stereo_codec_ = num_codec_channels == 2; |
- if (!mono_buffer_.get()) { |
- // Temporary space for DownConvertToCodecFormat. |
- mono_buffer_.reset(new int16_t[kMaxMonoDataSizeSamples]); |
+ // Chose the lowest native sample rate which is higher or equal than at least |
Andrew MacDonald
2015/09/23 02:35:52
A bit neater is to use the minimum of them. I'd re
aluebs-webrtc
2015/09/23 17:13:43
Done.
|
+ // one of the input or codec rates. |
+ for (size_t i = 0; i < AudioProcessing::kNumNativeSampleRates; ++i) { |
+ _audioFrame.sample_rate_hz_ = AudioProcessing::kNativeSampleRatesHz[i]; |
+ if (_audioFrame.sample_rate_hz_ >= sample_rate_hz || |
+ _audioFrame.sample_rate_hz_ >= codec_rate) { |
+ break; |
+ } |
} |
- DownConvertToCodecFormat(audio, |
- samples_per_channel, |
- num_channels, |
- sample_rate_hz, |
- num_codec_channels, |
- codec_rate, |
- mono_buffer_.get(), |
- &resampler_, |
- &_audioFrame); |
+ _audioFrame.num_channels_ = num_codec_channels; |
+ RemixAndResample(audio, samples_per_channel, num_channels, sample_rate_hz, |
+ &resampler_, &_audioFrame); |
} |
int32_t TransmitMixer::RecordAudioToFile( |