1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-13 21:28:01 +02:00

avformat/mp3enc: Avoid stack packet

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2021-03-18 07:28:03 +01:00
parent 751e334aa9
commit 0bf63099cd

View File

@ -381,17 +381,17 @@ static int mp3_write_audio_packet(AVFormatContext *s, AVPacket *pkt)
static int mp3_queue_flush(AVFormatContext *s) static int mp3_queue_flush(AVFormatContext *s)
{ {
MP3Context *mp3 = s->priv_data; MP3Context *mp3 = s->priv_data;
AVPacket pkt; AVPacket *const pkt = ffformatcontext(s)->pkt;
int ret = 0, write = 1; int ret = 0, write = 1;
ff_id3v2_finish(&mp3->id3, s->pb, s->metadata_header_padding); ff_id3v2_finish(&mp3->id3, s->pb, s->metadata_header_padding);
mp3_write_xing(s); mp3_write_xing(s);
while (mp3->queue) { while (mp3->queue) {
avpriv_packet_list_get(&mp3->queue, &mp3->queue_end, &pkt); avpriv_packet_list_get(&mp3->queue, &mp3->queue_end, pkt);
if (write && (ret = mp3_write_audio_packet(s, &pkt)) < 0) if (write && (ret = mp3_write_audio_packet(s, pkt)) < 0)
write = 0; write = 0;
av_packet_unref(&pkt); av_packet_unref(pkt);
} }
return ret; return ret;
} }