diff --git a/src/opus_encoder.c b/src/opus_encoder.c index 2701488d7fe80e4dfe4e8d828d6548b7d5a1e1ca..081d7bf4c4ea3bd9be6f647162a308d1d2a20cac 100644 --- a/src/opus_encoder.c +++ b/src/opus_encoder.c @@ -1816,7 +1816,10 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_ { if (st->mode == MODE_HYBRID) { - st->silk_mode.maxBits = IMIN(st->silk_mode.maxBits, st->silk_mode.bitRate * frame_size / st->Fs); + /* Allow SILK to steal up to 25% of the remaining bits */ + opus_int16 other_bits = IMAX(0, st->silk_mode.maxBits - st->silk_mode.bitRate * frame_size / st->Fs); + st->silk_mode.maxBits = IMAX(0, st->silk_mode.maxBits - other_bits*3/4); + st->silk_mode.useCBR = 0; } } else { /* Constrained VBR. */