changeset 36441:b75ebb89d803

Workaround VDPAU decode errors on aspect change on NVidia. The NVidia driver seems to expect a decoder reinit on aspect change, otherwise giving a nonsense VDP_STATUS_INVALID_SIZE error. Since decode and display can run out of sync, we do not in fact know when an aspect change will happen during decode but only when we want to display that decoded frame, and with threaded decoding these will differ significantly. So just catch the error and retry decoding instead, this also has the advantage of not affecting (and possibly costing performance) drivers without this issue.
author reimar
date Sun, 08 Dec 2013 15:07:00 +0000
parents 019636d54771
children ee46a4670903
files libvo/vo_vdpau.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_vdpau.c	Fri Dec 06 19:37:07 2013 +0000
+++ b/libvo/vo_vdpau.c	Sun Dec 08 15:07:00 2013 +0000
@@ -1031,6 +1031,12 @@
         return VO_FALSE;
 
     vdp_st = vdp_decoder_render(decoder, rndr->render_state->surface, rndr->info, rndr->bitstream_buffers_used, rndr->bitstream_buffers);
+    if (vdp_st == VDP_STATUS_INVALID_SIZE) {
+        // reinit to work around a NVidia bug on aspect change
+        if (!create_vdp_decoder(image_format, vid_width, vid_height, max_refs))
+            return VO_FALSE;
+        vdp_st = vdp_decoder_render(decoder, rndr->render_state->surface, rndr->info, rndr->bitstream_buffers_used, rndr->bitstream_buffers);
+    }
     CHECK_ST_WARNING("Failed VDPAU decoder rendering");
     return VO_TRUE;
 }