diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2025-04-10 22:20:33 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2025-04-13 22:49:21 +0200 |
commit | 62e1abcf0dfd7a105c12f73ce965f1946312be2c (patch) | |
tree | 664cda4ab7141363bede1c4813de7671e1e9977f | |
parent | 87f3e20931444a4c57c8e06576b71eb57014d5cb (diff) | |
download | ffmpeg-62e1abcf0dfd7a105c12f73ce965f1946312be2c.tar.gz |
avcodec/mpegaudioenc: Don't pad one bit at a time
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r-- | libavcodec/mpegaudioenc.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libavcodec/mpegaudioenc.c b/libavcodec/mpegaudioenc.c index 9a6aae6f78..49255b7f29 100644 --- a/libavcodec/mpegaudioenc.c +++ b/libavcodec/mpegaudioenc.c @@ -743,9 +743,12 @@ static void encode_frame(MpegAudioContext *s, av_assert1(put_bits_left(p) == padding); + /* flush */ + flush_put_bits(p); + /* padding */ - for(i=0;i<padding;i++) - put_bits(p, 1, 0); + if (put_bytes_left(p, 0)) + memset(put_bits_ptr(p), 0, put_bytes_left(p, 0)); } static int MPA_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, @@ -778,9 +781,6 @@ static int MPA_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, encode_frame(s, bit_alloc, padding); - /* flush */ - flush_put_bits(&s->pb); - if (frame->pts != AV_NOPTS_VALUE) avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->initial_padding); |