[FFmpeg-devel] [PATCH 41/41] avformat/flvdec: use ff_alloc_extradata()

Paul B Mahol onemda at gmail.com
Sun Oct 13 14:49:02 CEST 2013


Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
 libavformat/flvdec.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index d81a70b..d259927 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -246,9 +246,7 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream,
             vcodec->codec_id = AV_CODEC_ID_VP6A;
         if (read) {
             if (vcodec->extradata_size != 1) {
-                vcodec->extradata = av_malloc(1 + FF_INPUT_BUFFER_PADDING_SIZE);
-                if (vcodec->extradata)
-                    vcodec->extradata_size = 1;
+                ff_alloc_extradata(vcodec, 1);
             }
             if (vcodec->extradata)
                 vcodec->extradata[0] = avio_r8(s->pb);
@@ -616,10 +614,8 @@ static int flv_read_close(AVFormatContext *s)
 static int flv_get_extradata(AVFormatContext *s, AVStream *st, int size)
 {
     av_free(st->codec->extradata);
-    st->codec->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE);
-    if (!st->codec->extradata)
+    if (ff_alloc_extradata(st->codec, size))
         return AVERROR(ENOMEM);
-    st->codec->extradata_size = size;
     avio_read(s->pb, st->codec->extradata, st->codec->extradata_size);
     return 0;
 }
-- 
1.7.11.2



More information about the ffmpeg-devel mailing list