[FFmpeg-cvslog] avcodec/flacenc: fix calculation of bits required in case of custom sample rate

Paul B Mahol git at videolan.org
Mon Feb 1 03:06:50 CET 2016


ffmpeg | branch: release/2.6 | Paul B Mahol <onemda at gmail.com> | Sun Jan 24 20:47:49 2016 +0100| [f71e0b798a5091b98472a2f9a343283134240a31] | committer: Michael Niedermayer

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 at gmail.com>
Signed-off-by: Paul B Mahol <onemda at gmail.com>
(cherry picked from commit 3e7d6849120d61bb354376d52786c26f20e20835)

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

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f71e0b798a5091b98472a2f9a343283134240a31
---

 libavcodec/flacenc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c
index 78bd36a..c96609e 100644
--- a/libavcodec/flacenc.c
+++ b/libavcodec/flacenc.c
@@ -920,7 +920,7 @@ static int count_frame_header(FlacEncodeContext *s)
         count += 16;
 
     /* explicit sample rate */
-    count += ((s->sr_code[0] == 12) + (s->sr_code[0] > 12)) * 8;
+    count += ((s->sr_code[0] == 12) + (s->sr_code[0] > 12) * 2) * 8;
 
     /* frame header CRC-8 */
     count += 8;



More information about the ffmpeg-cvslog mailing list