diff options
author | Mark Harris <mark.hsj@gmail.com> | 2019-04-07 23:27:57 -0700 |
---|---|---|
committer | Mark Harris <mark.hsj@gmail.com> | 2019-04-08 21:40:42 -0700 |
commit | afea46e9d795bd08ee7f82fb65a9ff4a7d842b66 (patch) | |
tree | d3cb6687da12d86460f082a505ed81fdeb4541d7 /src | |
parent | 196511de23161330c74d123a2076892652c9dc95 (diff) | |
download | opus-afea46e9d795bd08ee7f82fb65a9ff4a7d842b66.tar.gz |
Correctly enable/disable SILK DTX with forced mode
Diffstat (limited to 'src')
-rw-r--r-- | src/opus_encoder.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/opus_encoder.c b/src/opus_encoder.c index ab9e3e89..2768aa37 100644 --- a/src/opus_encoder.c +++ b/src/opus_encoder.c @@ -1336,6 +1336,14 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_ equiv_rate = compute_equiv_rate(st->bitrate_bps, st->stream_channels, st->Fs/frame_size, st->use_vbr, 0, st->silk_mode.complexity, st->silk_mode.packetLossPercentage); + /* Allow SILK DTX if DTX is enabled but the generalized DTX cannot be used, + e.g. because of the complexity setting or sample rate. */ +#ifndef DISABLE_FLOAT_API + st->silk_mode.useDTX = st->use_dtx && !(analysis_info.valid || is_silence); +#else + st->silk_mode.useDTX = st->use_dtx; +#endif + /* Mode selection depending on application and signal type */ if (st->application == OPUS_APPLICATION_RESTRICTED_LOWDELAY) { @@ -1384,13 +1392,7 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_ 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 but the generalized DTX cannot be used, - because of complexity and sampling frequency settings, switch to SILK DTX and - set the encoder to SILK mode */ -#ifndef DISABLE_FLOAT_API - st->silk_mode.useDTX = st->use_dtx && !(analysis_info.valid || is_silence); -#else - st->silk_mode.useDTX = st->use_dtx; -#endif + use SILK in order to make use of its DTX. */ if (st->silk_mode.useDTX && voice_est > 100) st->mode = MODE_SILK_ONLY; #endif |