Adding FEC support in NetEq 4.

R=henrik.lundin@webrtc.org, turaj@webrtc.org

TEST=passes all trybots

BUG=

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5748 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
minyue@webrtc.org
2014-03-21 12:07:40 +00:00
parent 0e65fdaa3b
commit b28bfa7efc
16 changed files with 643 additions and 8 deletions

View File

@ -458,6 +458,19 @@ int AudioDecoderOpus::Decode(const uint8_t* encoded, size_t encoded_len,
return ret;
}
int AudioDecoderOpus::DecodeRedundant(const uint8_t* encoded,
size_t encoded_len, int16_t* decoded,
SpeechType* speech_type) {
int16_t temp_type = 1; // Default is speech.
int16_t ret = WebRtcOpus_DecodeFec(static_cast<OpusDecInst*>(state_), encoded,
static_cast<int16_t>(encoded_len), decoded,
&temp_type);
if (ret > 0)
ret *= static_cast<int16_t>(channels_); // Return total number of samples.
*speech_type = ConvertSpeechType(temp_type);
return ret;
}
int AudioDecoderOpus::Init() {
return WebRtcOpus_DecoderInitNew(static_cast<OpusDecInst*>(state_));
}
@ -467,6 +480,18 @@ int AudioDecoderOpus::PacketDuration(const uint8_t* encoded,
return WebRtcOpus_DurationEst(static_cast<OpusDecInst*>(state_),
encoded, static_cast<int>(encoded_len));
}
int AudioDecoderOpus::PacketDurationRedundant(const uint8_t* encoded,
size_t encoded_len) const {
return WebRtcOpus_FecDurationEst(encoded, static_cast<int>(encoded_len));
}
bool AudioDecoderOpus::PacketHasFec(const uint8_t* encoded,
size_t encoded_len) const {
int fec;
fec = WebRtcOpus_PacketHasFec(encoded, static_cast<int>(encoded_len));
return (fec == 1);
}
#endif
AudioDecoderCng::AudioDecoderCng(enum NetEqDecoder type)