prevent busting at ridiculously low bit-rate VBR
authorJean-Marc Valin <jean-marc.valin@usherbrooke.ca>
Thu, 22 Oct 2009 04:23:56 +0000 (00:23 -0400)
committerJean-Marc Valin <jean-marc.valin@usherbrooke.ca>
Thu, 22 Oct 2009 04:23:56 +0000 (00:23 -0400)
libcelt/celt.c

index 6f050f0..c7d1c09 100644 (file)
@@ -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;
    }