From 44e191457a1268a8112ec7b35cf18de2957123b3 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 11 Jan 2012 23:52:55 +0100 Subject: [PATCH] utils: check that parameters havnt changed in reget_buffer() Fixes Ticket902 Signed-off-by: Michael Niedermayer --- libavcodec/utils.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 78bc6e7626..91c5e43c2e 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -557,6 +557,11 @@ int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic){ assert(s->codec_type == AVMEDIA_TYPE_VIDEO); + if (pic->data[0] && (pic->width != s->width || pic->height != s->height || pic->format != s->pix_fmt)) { + av_log(s, AV_LOG_WARNING, "Width/height/fmt changing with reget buffer"); + s->release_buffer(s, pic); + } + /* If no picture return a new buffer */ if(pic->data[0] == NULL) { /* We will copy from buffer, so must be readable */