History

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

Andreas Rheinhardt committed 1 year ago

Commit 62e1abc1 parent 87f3e201 file · +5 −5Browse files

Unified · Split

libavcodec/mpegaudioenc.c+5−5
@@ -743,9 +743,12 @@ static void encode_frame(MpegAudioContext *s, · 742 unmodified lines
743 743
744 av_assert1(put_bits_left(p) == padding);744 av_assert1(put_bits_left(p) == padding);
745 745
746 /* flush */
747 flush_put_bits(p);
748
746 /* padding */749 /* padding */
747 for(i=0;i<padding;i++)750 if (put_bytes_left(p, 0))
748 put_bits(p, 1, 0);751 memset(put_bits_ptr(p), 0, put_bytes_left(p, 0));
749}752}
750 753
751static int MPA_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,754static int MPA_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
@@ -778,9 +781,6 @@ static int MPA_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, · 26 unmodified lines
778 781
779 encode_frame(s, bit_alloc, padding);782 encode_frame(s, bit_alloc, padding);
780 783
781 /* flush */
782 flush_put_bits(&s->pb);
783
784 if (frame->pts != AV_NOPTS_VALUE)784 if (frame->pts != AV_NOPTS_VALUE)
785 avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->initial_padding);785 avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->initial_padding);
786 786

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t