WebRTC Opus C interface: Add support for non-48 kHz decode sample rate

Plus tests for 16 kHz.

Bug: webrtc:10631
Change-Id: I2d89bc6d0d9548f0ad7bb1e36d6dfde6b6b31f83
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/138072
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Minyue Li <minyue@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28099}
This commit is contained in:
Karl Wiberg
2019-05-28 14:41:07 +02:00
committed by Commit Bot
parent 232b6a16cc
commit a1d1a1e976
9 changed files with 170 additions and 135 deletions

View File

@ -23,7 +23,7 @@ namespace webrtc {
AudioDecoderOpusImpl::AudioDecoderOpusImpl(size_t num_channels)
: channels_(num_channels) {
RTC_DCHECK(num_channels == 1 || num_channels == 2);
const int error = WebRtcOpus_DecoderCreate(&dec_state_, channels_);
const int error = WebRtcOpus_DecoderCreate(&dec_state_, channels_, 48000);
RTC_DCHECK(error == 0);
WebRtcOpus_DecoderInit(dec_state_);
}
@ -104,7 +104,7 @@ int AudioDecoderOpusImpl::PacketDurationRedundant(const uint8_t* encoded,
return PacketDuration(encoded, encoded_len);
}
return WebRtcOpus_FecDurationEst(encoded, encoded_len);
return WebRtcOpus_FecDurationEst(encoded, encoded_len, 48000);
}
bool AudioDecoderOpusImpl::PacketHasFec(const uint8_t* encoded,