[FFmpeg-devel] [PATCH 2/2] utils: check that parameters havnt changed in reget_buffer()

Michael Niedermayer michaelni at gmx.at
Thu Jan 12 00:02:47 CET 2012


Fixes Ticket902

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavcodec/utils.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index b79e23e..2b091e1 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -564,6 +564,13 @@ int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic){
         return s->get_buffer(s, pic);
     }
 
+    if (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);
+        pic->buffer_hints |= FF_BUFFER_HINTS_READABLE;
+        return s->get_buffer(s,pic);
+    }
+
     /* If internal buffer type return the same buffer */
     if(pic->type == FF_BUFFER_TYPE_INTERNAL) {
         if(s->pkt) pic->pkt_pts= s->pkt->pts;
-- 
1.7.5.4



More information about the ffmpeg-devel mailing list