Opus: Let the decoder interpret 2-byte payloads as DTX/CNG packets

This CL matches the work done in
https://codereview.webrtc.org/2693453003.

BUG=webrtc:7272
TBR=minyue@webrtc.org

Review-Url: https://codereview.webrtc.org/2723893004
Cr-Commit-Position: refs/heads/master@{#16930}
This commit is contained in:
henrik.lundin
2017-03-01 00:49:18 -08:00
committed by Commit bot
parent e985b3fe49
commit deaf6fb071

View File

@ -283,7 +283,11 @@ static int16_t DetermineAudioType(OpusDecInst* inst, size_t encoded_bytes) {
// to be so if the following |encoded_byte| are 0 or 1.
if (encoded_bytes == 0 && inst->in_dtx_mode) {
return 2; // Comfort noise.
} else if (encoded_bytes == 1) {
} else if (encoded_bytes == 1 || encoded_bytes == 2) {
// TODO(henrik.lundin): There is a slight risk that a 2-byte payload is in
// fact a 1-byte TOC with a 1-byte payload. That will be erroneously
// interpreted as comfort noise output, but such a payload is probably
// faulty anyway.
inst->in_dtx_mode = 1;
return 2; // Comfort noise.
} else {