Prevents an invalid ToC to be generated at ridiculously low rate
authorJean-Marc Valin <jmvalin@jmvalin.ca>
Thu, 7 Jul 2016 05:23:11 +0000 (01:23 -0400)
committerJean-Marc Valin <jmvalin@jmvalin.ca>
Thu, 7 Jul 2016 05:23:11 +0000 (01:23 -0400)
src/opus_encoder.c

index 5e6c59b..5f5a33c 100644 (file)
@@ -1065,7 +1065,7 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_
           bw=OPUS_BANDWIDTH_WIDEBAND;
        else if (tocmode==MODE_CELT_ONLY&&bw==OPUS_BANDWIDTH_MEDIUMBAND)
           bw=OPUS_BANDWIDTH_NARROWBAND;
-       else if (bw<=OPUS_BANDWIDTH_SUPERWIDEBAND)
+       else if (tocmode==MODE_HYBRID&&bw<=OPUS_BANDWIDTH_SUPERWIDEBAND)
           bw=OPUS_BANDWIDTH_SUPERWIDEBAND;
        data[0] = gen_toc(tocmode, frame_rate, bw, st->stream_channels);
        RESTORE_STACK;