Browse code

avcodec/flacenc: fix calculation of bits required in case of custom sample rate

Sample rate of 11025 takes 16 bits but previous code would pick only 8.
Fixes assertion failure.

Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Signed-off-by: Paul B Mahol <onemda@gmail.com>
(cherry picked from commit 3e7d6849120d61bb354376d52786c26f20e20835)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>

Paul B Mahol authored on 2016/01/25 04:47:49
Showing 1 changed files
... ...
@@ -916,7 +916,7 @@ static int count_frame_header(FlacEncodeContext *s)
916 916
         count += 16;
917 917
 
918 918
     /* explicit sample rate */
919
-    count += ((s->sr_code[0] == 12) + (s->sr_code[0] > 12)) * 8;
919
+    count += ((s->sr_code[0] == 12) + (s->sr_code[0] > 12) * 2) * 8;
920 920
 
921 921
     /* frame header CRC-8 */
922 922
     count += 8;