summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-05-14 01:10:05 +0200
committerwm4 <wm4@nowhere>2013-05-14 01:10:05 +0200
commitbc8815d69f4579ae1b87afecf72c86984441064c (patch)
treef8ca617bf10c5f2e8870e7658981aab198d6f46b
parent647291bab27e8851824aa93414c8ff09ca45c17b (diff)
downloadmpv-bc8815d69f4579ae1b87afecf72c86984441064c.tar.bz2
mpv-bc8815d69f4579ae1b87afecf72c86984441064c.tar.xz
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.
-rw-r--r--video/decode/vd_lavc.c11
1 files changed, 10 insertions, 1 deletions
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));