1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

avcodec/mpegaudioenc: Don't pad one bit at a time

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2025-04-10 22:20:33 +02:00
parent 87f3e20931
commit 62e1abcf0d

View File

@ -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);