[MPlayer-cvslog] r36540 - trunk/libvo/vo_vdpau.c

reimar subversion at mplayerhq.hu
Sun Dec 8 19:29:09 CET 2013


Author: reimar
Date: Sun Dec  8 19:29:09 2013
New Revision: 36540

Log:
Make handling of query_format more robust.

Modified:
   trunk/libvo/vo_vdpau.c

Modified: trunk/libvo/vo_vdpau.c
==============================================================================
--- trunk/libvo/vo_vdpau.c	Sun Dec  8 18:53:59 2013	(r36539)
+++ trunk/libvo/vo_vdpau.c	Sun Dec  8 19:29:09 2013	(r36540)
@@ -690,6 +690,12 @@ static int config(uint32_t width, uint32
 #endif
     flip = flags & VOFLAG_FLIPPING;
 
+    if (IMGFMT_IS_VDPAU(image_format) && decoder == VDP_INVALID_HANDLE) {
+        mp_msg(MSGT_VO, MSGL_WARN, "[vdpau] Unexpected reinit, query_format called too often?\n");
+        // force a full reinit, otherwise we might run into issues with
+        // some implementations
+        image_format = 0;
+    }
     if (image_format == format &&
         vid_width    == width  &&
         vid_height   == height) {
@@ -1147,8 +1153,15 @@ static int query_format(uint32_t format)
     case IMGFMT_VDPAU_WMV3:
     case IMGFMT_VDPAU_VC1:
     case IMGFMT_VDPAU_MPEG4:
-        if (create_vdp_decoder(format, 48, 48, 2))
+        // Note: this will break the current decoder
+        // Not all implementations support safely instantiating
+        // a second decoder, so this is the "lesser evil"
+        if (create_vdp_decoder(format, 48, 48, 2)) {
+            vdp_decoder_destroy(decoder);
+            decoder = VDP_INVALID_HANDLE;
+            decoder_max_refs = -1;
             return default_flags;
+        }
     }
     return 0;
 }


More information about the MPlayer-cvslog mailing list