[FFmpeg-devel] [PATCH 2/3] avformat/flvenc: Don't reimplement ff_alloc_extradata
Andreas Rheinhardt
andreas.rheinhardt at gmail.com
Tue Dec 10 03:41:44 EET 2019
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
libavformat/flvenc.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index 872050a74f..862082dd2d 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -908,14 +908,10 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
int side_size = 0;
uint8_t *side = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size);
if (side && side_size > 0 && (side_size != par->extradata_size || memcmp(side, par->extradata, side_size))) {
- av_free(par->extradata);
- par->extradata = av_mallocz(side_size + AV_INPUT_BUFFER_PADDING_SIZE);
- if (!par->extradata) {
- par->extradata_size = 0;
- return AVERROR(ENOMEM);
- }
+ ret = ff_alloc_extradata(par, side_size);
+ if (ret < 0)
+ return ret;
memcpy(par->extradata, side, side_size);
- par->extradata_size = side_size;
flv_write_codec_header(s, par, pkt->dts);
}
}
--
2.20.1
More information about the ffmpeg-devel
mailing list