[vlc-devel] [PATCH 1/2] direct3d11: fix crash when subpictures have nil dimensions

Steve Lhomme robux4 at videolabs.io
Thu Oct 13 10:00:56 CEST 2016


---
 modules/video_output/win32/direct3d11.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 8ca723e..ffca116 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -964,7 +964,8 @@ static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
     if (subpicture) {
         // draw the additional vertices
         for (int i = 0; i < sys->d3dregion_count; ++i) {
-            DisplayD3DPicture(sys, (d3d_quad_t *) sys->d3dregions[i]->p_sys);
+            if (sys->d3dregions[i])
+                DisplayD3DPicture(sys, (d3d_quad_t *) sys->d3dregions[i]->p_sys);
         }
     }
 
@@ -2015,6 +2016,9 @@ static int Direct3D11MapSubpicture(vout_display_t *vd, int *subpicture_region_co
 
     int i = 0;
     for (subpicture_region_t *r = subpicture->p_region; r; r = r->p_next, i++) {
+        if (!r->fmt.i_width || !r->fmt.i_height)
+            continue; // won't render anything, keep the cache for later
+
         for (int j = 0; j < sys->d3dregion_count; j++) {
             picture_t *cache = sys->d3dregions[j];
             if (cache != NULL && ((d3d_quad_t *) cache->p_sys)->pTexture) {
-- 
2.8.2



More information about the vlc-devel mailing list