From bc8815d69f4579ae1b87afecf72c86984441064c Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 14 May 2013 01:10:05 +0200 Subject: vd_lavc: hack-fix vdpau decoding with non mod 16 video This changes the code so that it does the same as MPlayer, mplayer2 and mpv before ref-counted AVFrame. The problem is that get_buffer2 is called with aligned frame dimensions, while get_buffer didn't. This breaks the mpv video frame size change detection. --- video/decode/vd_lavc.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'video') diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index c3e9ce5860..d723318c4e 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -517,7 +517,16 @@ static struct mp_image *get_surface_hwdec(struct sh_video *sh, AVFrame *pic) if (!IMGFMT_IS_HWACCEL(imgfmt)) return NULL; - if (init_vo(sh, pic) < 0) + // Video with non mod-16 width/height will have allocation sizes that are + // rounded up. This conflicts with our video size change detection and + // leads to an endless loop. On the other hand, vdpau seems to round up + // frame allocations internally. So use the original video resolution + // instead. + AVFrame pic_resized = *pic; + pic_resized.width = ctx->avctx->width; + pic_resized.height = ctx->avctx->height; + + if (init_vo(sh, &pic_resized) < 0) return NULL; assert(IMGFMT_IS_HWACCEL(ctx->best_csp)); -- cgit v1.2.3