Also, return void from output_frame_end() instead of the frame size. We already 
know the frame size.
---
 libavcodec/ac3enc.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git libavcodec/ac3enc.c libavcodec/ac3enc.c
index 2e6f8e4..911a684 100644
--- libavcodec/ac3enc.c
+++ libavcodec/ac3enc.c
@@ -1268,7 +1268,7 @@ static unsigned int pow_poly(unsigned int a, unsigned int n, unsigned int poly)
 }
 
 /* fill the end of the frame and compute the two crcs */
-static int output_frame_end(AC3EncodeContext *s)
+static void output_frame_end(AC3EncodeContext *s)
 {
     int frame_size, frame_size_58, n, crc1, crc2, crc_inv;
     uint8_t *frame;
@@ -1299,7 +1299,6 @@ static int output_frame_end(AC3EncodeContext *s)
     AV_WB16(frame+2*frame_size-2, crc2);
 
     //    printf("n=%d frame_size=%d\n", n, frame_size);
-    return frame_size * 2;
 }
 
 static void deinterleave_samples(AC3EncodeContext *s, const int16_t *samples)
@@ -1402,7 +1401,7 @@ static int AC3_encode_frame(AVCodecContext *avctx,
     uint8_t exp[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS][AC3_MAX_COEFS];
     uint8_t exp_strategy[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS];
     int8_t exp_shift[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS];
-    int frame_size, err;
+    int err;
 
     adjust_frame_size(s);
 
@@ -1439,12 +1438,12 @@ static int AC3_encode_frame(AVCodecContext *avctx,
         output_audio_block(s, exp_strategy[blk], exp[blk],
                            mdct_coef[blk], exp_shift[blk], blk);
     }
-    frame_size = output_frame_end(s);
+    output_frame_end(s);
 
-    s->bits_written    += frame_size * 8;
+    s->bits_written    += s->frame_size * 16;
     s->samples_written += AC3_FRAME_SIZE;
 
-    return frame_size;
+    return s->frame_size * 2;
 }
 
 static av_cold int AC3_encode_close(AVCodecContext *avctx)
_______________________________________________
FFmpeg-soc mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc

Reply via email to