Commit 20aed9ed authored by Michael Niedermayer's avatar Michael Niedermayer

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

Fixes bug127
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 969ba65e
...@@ -469,9 +469,8 @@ static void reset_options(OptionsContext *o, int is_input) ...@@ -469,9 +469,8 @@ static void reset_options(OptionsContext *o, int is_input)
init_opts(); 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)); FrameBuffer *buf = av_mallocz(sizeof(*buf));
int ret, i; int ret, i;
const int pixel_size = av_pix_fmt_descriptors[s->pix_fmt].comp[0].step_minus1+1; 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) ...@@ -547,7 +546,7 @@ static int codec_get_buffer(AVCodecContext *s, AVFrame *frame)
FrameBuffer *buf; FrameBuffer *buf;
int ret, i; 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; return ret;
buf = ist->buffer_pool; buf = ist->buffer_pool;
...@@ -557,7 +556,7 @@ static int codec_get_buffer(AVCodecContext *s, AVFrame *frame) ...@@ -557,7 +556,7 @@ static int codec_get_buffer(AVCodecContext *s, AVFrame *frame)
av_freep(&buf->base[0]); av_freep(&buf->base[0]);
av_free(buf); av_free(buf);
ist->dr1 = 0; ist->dr1 = 0;
if ((ret = alloc_buffer(ist, &buf)) < 0) if ((ret = alloc_buffer(s, ist, &buf)) < 0)
return ret; return ret;
} }
buf->refcount++; buf->refcount++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment