[vlc-devel] [PATCH 1/2] dxva2: allocate the requested number of surfaces

Steve Lhomme robux4 at videolabs.io
Tue Aug 2 11:15:07 CEST 2016


The +1 of CreateSurface is an internal thing. There are cases where the
allocation succeeds but the use of buffer crashes as soon as we do BeginFrame().
This change fixes this crash. Either we can allocate and it works, either we
can't allocate and it won't crash.
---
 modules/codec/avcodec/dxva2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index 583a236..f08865f 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -703,7 +703,7 @@ static int DxCreateVideoDecoder(vlc_va_t *va, int codec_id, const video_format_t
     hr = IDirectXVideoDecoderService_CreateSurface((IDirectXVideoDecoderService*) sys->d3ddec,
                                                          sys->surface_width,
                                                          sys->surface_height,
-                                                         sys->surface_count - 1,
+                                                         sys->surface_count,
                                                          p_sys->render,
                                                          D3DPOOL_DEFAULT,
                                                          0,
-- 
2.8.2



More information about the vlc-devel mailing list