shithub: opus-tools

Download patch

ref: 07d15f66940b8ece17611e2c89506fb923822f95
parent: 08a66f71fc95a01b8360fd9556bd8863db2c5492
author: Gregory Maxwell <greg@xiph.org>
date: Fri Jul 13 11:08:17 EDT 2012

Clamp LSB depth to avoid failures on weird files.

--- a/src/opusenc.c
+++ b/src/opusenc.c
@@ -616,7 +616,7 @@
   }
 
 #ifdef OPUS_SET_LSB_DEPTH
-  ret=opus_multistream_encoder_ctl(st, OPUS_SET_LSB_DEPTH(inopt.samplesize));
+  ret=opus_multistream_encoder_ctl(st, OPUS_SET_LSB_DEPTH(IMAX(8,IMIN(24,inopt.samplesize))));
   if(ret!=OPUS_OK){
     fprintf(stderr,"OPUS_SET_LSB_DEPTH returned: %s\n",opus_strerror(ret));
     exit(1);