Consolidate audio conversion from Channel and TransmitMixer.
Replace the two versions with a single DownConvertToCodecFormat. As mentioned in comments, this could be further consolidated with RemixAndResample but we should write a full audio converter class in that case. Along the way: - Fix the bug present in Channel::Demultiplex with mono input and a stereo codec. - Remove the 32 kHz max from the OnDataAvailable path. This avoids a 48 -> 32 -> 48 conversion when VoE is passed 48 kHz audio; instead we get a straight pass-through to ACM. The 32 kHz conversion is still needed in the RecordedDataIsAvailable path until APM natively supports 48 kHz. - Merge resampler improvements from ACM1 to ACM2. This allows ACM to handle 44.1 kHz audio passed to VoE and was originally done here: https://webrtc-codereview.appspot.com/1590004 - Reuse the RemixAndResample unit tests for DownConvertToCodecFormat. - Remove unused functions from utility.cc. BUG=3155,3000,b/12867572 TESTED=voe_cmd_test using both the OnDataAvailable and RecordedDataIsAvailable paths, with a captured audio format of all combinations of {44.1,48} kHz and {1,2} channels, running through all codecs, and finally using both ACM1 and ACM2. R=henrika@webrtc.org, turaj@webrtc.org, xians@webrtc.org Review URL: https://webrtc-codereview.appspot.com/11019005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5843 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -1273,11 +1273,7 @@ int32_t AudioCodingModuleImpl::Add10MsData(
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Allow for 8, 16, 32 and 48kHz input audio.
|
||||
if ((audio_frame.sample_rate_hz_ != 8000)
|
||||
&& (audio_frame.sample_rate_hz_ != 16000)
|
||||
&& (audio_frame.sample_rate_hz_ != 32000)
|
||||
&& (audio_frame.sample_rate_hz_ != 48000)) {
|
||||
if (audio_frame.sample_rate_hz_ > 48000) {
|
||||
assert(false);
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
|
||||
"Cannot Add 10 ms audio, input frequency not valid");
|
||||
@ -1444,7 +1440,7 @@ int AudioCodingModuleImpl::PreprocessToAddData(const AudioFrame& in_frame,
|
||||
|
||||
if (preprocess_frame_.samples_per_channel_ < 0) {
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
|
||||
"Cannot add 10 ms audio, resmapling failed");
|
||||
"Cannot add 10 ms audio, resampling failed");
|
||||
return -1;
|
||||
}
|
||||
preprocess_frame_.sample_rate_hz_ = send_codec_inst_.plfreq;
|
||||
|
||||
Reference in New Issue
Block a user