# HG changeset patch # User reimar # Date 1323108509 0 # Node ID 119af6360b00af59cbc2d8bbfa989abb494d37b3 # Parent c25804f1521e69fe82519081c2b8d28fe20c2b31 Discard frames where the size does not match the AVCodecContext width/height. This avoids possible crashes on video size changes. The problem is that we reinitialize the vo on get_buffer but due to codec delay libavcodec might still return frames with the old size afterwards, which the vo might no longer be able to handle. Ideally libavcodec should not show this behaviour, since it requires that any application using DR1 can handle frames of different sizes simultaneously - which seems a bit extreme. diff -r c25804f1521e -r 119af6360b00 libmpcodecs/vd_ffmpeg.c --- a/libmpcodecs/vd_ffmpeg.c Mon Dec 05 11:38:15 2011 +0000 +++ b/libmpcodecs/vd_ffmpeg.c Mon Dec 05 18:08:29 2011 +0000 @@ -897,12 +897,18 @@ if(!mpi) mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE, - avctx->width, avctx->height); + pic->width, pic->height); if(!mpi){ // temporary! mp_msg(MSGT_DECVIDEO, MSGL_WARN, MSGTR_MPCODECS_CouldntAllocateImageForCodec); return NULL; } + if (mpi->w != pic->width || mpi->h != pic->height || + pic->width != avctx->width || pic->height != avctx->height) { + mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Dropping frame with size not matching configured size\n"); + return NULL; + } + if(!dr1){ mpi->planes[0]=pic->data[0]; mpi->planes[1]=pic->data[1];