Better handling of DTX for range coder state checks

This commit is contained in:
Jean-Marc Valin 2011-08-20 00:21:46 -04:00
parent d48277374a
commit 2b98bdf532
2 changed files with 5 additions and 1 deletions

View file

@ -442,6 +442,9 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
st->channels, window, st->Fs); st->channels, window, st->Fs);
} }
if (len <= 1)
st->rangeFinal = 0;
else
st->rangeFinal = dec.rng ^ redundant_rng; st->rangeFinal = dec.rng ^ redundant_rng;
st->prev_mode = mode; st->prev_mode = mode;

View file

@ -261,6 +261,7 @@ int opus_encode_float(OpusEncoder *st, const opus_val16 *pcm, int frame_size,
opus_uint32 redundant_rng = 0; opus_uint32 redundant_rng = 0;
ALLOC_STACK; ALLOC_STACK;
st->rangeFinal = 0;
if (400*frame_size != st->Fs && 200*frame_size != st->Fs && 100*frame_size != st->Fs && if (400*frame_size != st->Fs && 200*frame_size != st->Fs && 100*frame_size != st->Fs &&
50*frame_size != st->Fs && 25*frame_size != st->Fs && 50*frame_size != 3*st->Fs) 50*frame_size != st->Fs && 25*frame_size != st->Fs && 50*frame_size != 3*st->Fs)
return OPUS_BAD_ARG; return OPUS_BAD_ARG;