diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2005-07-17 12:56:56 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2005-07-17 12:56:56 +0000 |
commit | 4c1a012e9ceb0840688c547625208e7c4b81624a (patch) | |
tree | d5573ece0d80440d1ebefada16815eba33ebc90b | |
parent | e33943728e775ef9f3239fe950f3be4fa405d1f2 (diff) | |
download | ffmpeg-4c1a012e9ceb0840688c547625208e7c4b81624a.tar.gz |
dont pre allocate uselessly large buffer and dont ignore FF_INPUT_BUFFER_PADDING_SIZE
Originally committed as revision 4452 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/mjpeg.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/libavcodec/mjpeg.c b/libavcodec/mjpeg.c index bfce40c4ad..7aaf1e73ad 100644 --- a/libavcodec/mjpeg.c +++ b/libavcodec/mjpeg.c @@ -896,11 +896,8 @@ static int mjpeg_decode_init(AVCodecContext *avctx) s->idct_put= s2.dsp.idct_put; s->mpeg_enc_ctx_allocated = 0; - s->buffer_size = 102400; /* smaller buffer should be enough, - but photojpg files could ahive bigger sizes */ - s->buffer = av_malloc(s->buffer_size); - if (!s->buffer) - return -1; + s->buffer_size = 0; + s->buffer = NULL; s->start_code = -1; s->first_picture = 1; s->org_height = avctx->coded_height; @@ -1841,7 +1838,7 @@ static int mjpeg_decode_frame(AVCodecContext *avctx, { av_free(s->buffer); s->buffer_size = buf_end-buf_ptr; - s->buffer = av_malloc(s->buffer_size); + s->buffer = av_malloc(s->buffer_size + FF_INPUT_BUFFER_PADDING_SIZE); dprintf("buffer too small, expanding to %d bytes\n", s->buffer_size); } |