Mercurial > mplayer.hg
changeset 34309:119af6360b00
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.
author | reimar |
---|---|
date | Mon, 05 Dec 2011 18:08:29 +0000 |
parents | c25804f1521e |
children | 7ef4cfcb1791 |
files | libmpcodecs/vd_ffmpeg.c |
diffstat | 1 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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];