Making sure DTX for voice still works at high bit-rate

This commit is contained in:
Jean-Marc Valin 2011-10-27 13:39:12 -04:00
parent 6b9c29aee4
commit 6ef378725f

View file

@ -580,8 +580,12 @@ int opus_encode_float(OpusEncoder *st, const opus_val16 *pcm, int frame_size,
st->mode = (equiv_rate >= threshold) ? MODE_CELT_ONLY: MODE_SILK_ONLY;
/* When FEC is enabled and there's enough packet loss, use SILK */
if (st->silk_mode.useInBandFEC && st->silk_mode.packetLossPercentage > (128-voice_est)>>4)
st->mode = MODE_SILK_ONLY;
/* When encoding voice and DTX is enabled, set the encoder to SILK mode (at least for now) */
if (st->silk_mode.useDTX && voice_est > 100)
st->mode = MODE_SILK_ONLY;
#endif
} else {
st->mode = st->user_forced_mode;