aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFelicia Lim <flim@google.com>2016-10-26 16:48:38 -0700
committerJean-Marc Valin <jmvalin@jmvalin.ca>2016-10-27 23:36:57 -0400
commit33698ee159ab6ab1de5ae86c62249d0c2ae4d8f7 (patch)
treed25adeec4176cdcf5f1673adcec721492c7e9609 /src
parent9962bf3d941c68c2e167cb4f4fe79eb32f98f2a2 (diff)
downloadlibopus-33698ee159ab6ab1de5ae86c62249d0c2ae4d8f7.tar.gz
Update bandwidth and opusCanSwitch before generating SILK DTX ToC
Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
Diffstat (limited to 'src')
-rw-r--r--src/opus_encoder.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/opus_encoder.c b/src/opus_encoder.c
index 79ef3f1f..5d959848 100644
--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -2070,13 +2070,7 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_
RESTORE_STACK;
return OPUS_INTERNAL_ERROR;
}
- if (nBytes==0)
- {
- st->rangeFinal = 0;
- data[-1] = gen_toc(st->mode, st->Fs/frame_size, curr_bandwidth, st->stream_channels);
- RESTORE_STACK;
- return 1;
- }
+
/* Extract SILK internal bandwidth for signaling in first byte */
if( st->mode == MODE_SILK_ONLY ) {
if( st->silk_mode.internalSampleRate == 8000 ) {
@@ -2091,6 +2085,15 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_
}
st->silk_mode.opusCanSwitch = st->silk_mode.switchReady && !st->nonfinal_frame;
+
+ if (nBytes==0)
+ {
+ st->rangeFinal = 0;
+ data[-1] = gen_toc(st->mode, st->Fs/frame_size, curr_bandwidth, st->stream_channels);
+ RESTORE_STACK;
+ return 1;
+ }
+
/* FIXME: How do we allocate the redundancy for CBR? */
if (st->silk_mode.opusCanSwitch)
{