# HG changeset patch # User reimar # Date 1386527349 0 # Node ID 45e6b96cb2e17cec160003d38d9d81cfde0c6fbe # Parent 0d52d44ad7b611367ae0da6edc6cc00b2a186d89 Make handling of query_format more robust. diff -r 0d52d44ad7b6 -r 45e6b96cb2e1 libvo/vo_vdpau.c --- a/libvo/vo_vdpau.c Sun Dec 08 17:53:59 2013 +0000 +++ b/libvo/vo_vdpau.c Sun Dec 08 18:29:09 2013 +0000 @@ -690,6 +690,12 @@ #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 @@ 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; }