Added Opus stereo support

TESTED=git try
BUG=webrtc:1360
R=tina.legrand@webrtc.org, turaj@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/1868004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4521 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
minyue@webrtc.org
2013-08-12 06:48:09 +00:00
parent 91053e7c5a
commit ecbe0aa543
4 changed files with 89 additions and 23 deletions

View File

@ -393,19 +393,17 @@ AudioDecoderOpus::~AudioDecoderOpus() {
int AudioDecoderOpus::Decode(const uint8_t* encoded, size_t encoded_len,
int16_t* decoded, SpeechType* speech_type) {
int16_t temp_type = 1; // Default is speech.
assert(channels_ == 1);
// TODO(hlundin): Allow 2 channels when WebRtcOpus_Decode provides both
// channels interleaved.
int16_t ret = WebRtcOpus_Decode(
static_cast<OpusDecInst*>(state_),
const_cast<int16_t*>(reinterpret_cast<const int16_t*>(encoded)),
static_cast<int16_t>(encoded_len), decoded, &temp_type);
int16_t ret = WebRtcOpus_DecodeNew(static_cast<OpusDecInst*>(state_), encoded,
static_cast<int16_t>(encoded_len), decoded,
&temp_type);
if (ret > 0)
ret *= channels_; // Return total number of samples.
*speech_type = ConvertSpeechType(temp_type);
return ret;
}
int AudioDecoderOpus::Init() {
return WebRtcOpus_DecoderInit(static_cast<OpusDecInst*>(state_));
return WebRtcOpus_DecoderInitNew(static_cast<OpusDecInst*>(state_));
}
int AudioDecoderOpus::PacketDuration(const uint8_t* encoded,