[FFmpeg-cvslog] ffmpeg: Allocate buffers of the size needed by the decoder.

Michael Niedermayer git at videolan.org
Tue Jan 24 15:39:02 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Jan 24 01:29:03 2012 +0100| [20aed9ed4f4cae6a2feabbea5fb48bad75359538] | committer: Michael Niedermayer

ffmpeg: Allocate buffers of the size needed by the decoder.

Fixes bug127

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=20aed9ed4f4cae6a2feabbea5fb48bad75359538
---

 ffmpeg.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index f7da14c..0fe4186 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -469,9 +469,8 @@ static void reset_options(OptionsContext *o, int is_input)
     init_opts();
 }
 
-static int alloc_buffer(InputStream *ist, FrameBuffer **pbuf)
+static int alloc_buffer(AVCodecContext *s, InputStream *ist, FrameBuffer **pbuf)
 {
-    AVCodecContext *s = ist->st->codec;
     FrameBuffer  *buf = av_mallocz(sizeof(*buf));
     int ret, i;
     const int pixel_size = av_pix_fmt_descriptors[s->pix_fmt].comp[0].step_minus1+1;
@@ -547,7 +546,7 @@ static int codec_get_buffer(AVCodecContext *s, AVFrame *frame)
     FrameBuffer *buf;
     int ret, i;
 
-    if (!ist->buffer_pool && (ret = alloc_buffer(ist, &ist->buffer_pool)) < 0)
+    if (!ist->buffer_pool && (ret = alloc_buffer(s, ist, &ist->buffer_pool)) < 0)
         return ret;
 
     buf              = ist->buffer_pool;
@@ -557,7 +556,7 @@ static int codec_get_buffer(AVCodecContext *s, AVFrame *frame)
         av_freep(&buf->base[0]);
         av_free(buf);
         ist->dr1 = 0;
-        if ((ret = alloc_buffer(ist, &buf)) < 0)
+        if ((ret = alloc_buffer(s, ist, &buf)) < 0)
             return ret;
     }
     buf->refcount++;



More information about the ffmpeg-cvslog mailing list