From 7a047ea09676f92253b54c7e45be520a1fea52f1 Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin Date: Thu, 22 Oct 2009 00:23:56 -0400 Subject: [PATCH] prevent busting at ridiculously low bit-rate VBR --- libcelt/celt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libcelt/celt.c b/libcelt/celt.c index 6f050f0f..c7d1c095 100644 --- a/libcelt/celt.c +++ b/libcelt/celt.c @@ -770,7 +770,9 @@ int celt_encode_float(CELTEncoder * restrict st, const celt_sig * pcm, celt_sig celt_int32 vbr_bound, max_allowed; vbr_bound = st->vbr_rate; - max_allowed = (st->vbr_rate + vbr_bound - st->vbr_reservoir)>>(BITRES+3); + max_allowed = (st->vbr_rate + vbr_bound - st->vbr_reservoir)>>(BITRES+3); + if (max_allowed < 4) + max_allowed = 4; if (max_allowed < nbCompressedBytes) nbCompressedBytes = max_allowed; }