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.
This commit is contained in:
wm4 2013-05-14 01:10:05 +02:00
parent 647291bab2
commit bc8815d69f
1 changed files with 10 additions and 1 deletions

View File

@ -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));