summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/opus_encoder.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/opus_encoder.c b/src/opus_encoder.c
index 2768aa37..e98ac5b8 100644
--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -2727,6 +2727,33 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...)
ret = celt_encoder_ctl(celt_enc, OPUS_SET_ENERGY_MASK(value));
}
break;
+ case OPUS_GET_IN_DTX_REQUEST:
+ {
+ opus_int32 *value = va_arg(ap, opus_int32*);
+ if (!value)
+ {
+ goto bad_arg;
+ }
+ if (st->silk_mode.useDTX && (st->prev_mode == MODE_SILK_ONLY || st->prev_mode == MODE_HYBRID)) {
+ /* DTX determined by Silk. */
+ int n;
+ void *silk_enc = (char*)st+st->silk_enc_offset;
+ *value = 1;
+ for (n=0;n<st->silk_mode.nChannelsInternal;n++) {
+ *value = *value && ((silk_encoder*)silk_enc)->state_Fxx[n].sCmn.noSpeechCounter >= NB_SPEECH_FRAMES_BEFORE_DTX;
+ }
+ }
+#ifndef DISABLE_FLOAT_API
+ else if (st->use_dtx) {
+ /* DTX determined by Opus. */
+ *value = st->nb_no_activity_frames >= NB_SPEECH_FRAMES_BEFORE_DTX;
+ }
+#endif
+ else {
+ *value = 0;
+ }
+ }
+ break;
case CELT_GET_MODE_REQUEST:
{