[vlc-devel] [PATCH 3/5] macosx: don't keep a local copy of the vout_display_cfg_t

Steve Lhomme robux4 at ycbcr.xyz
Mon Nov 2 16:18:13 CET 2020


We can always use vd->cfg directly or use a local copy if necessary.
---
 modules/video_output/macosx.m | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
index 67844f4f4e0..171bf2223b3 100644
--- a/modules/video_output/macosx.m
+++ b/modules/video_output/macosx.m
@@ -116,8 +116,6 @@ struct vout_display_sys_t
 
     picture_t *current;
     bool has_first_frame;
-
-    vout_display_cfg_t cfg;
 };
 
 struct gl_sys
@@ -153,7 +151,6 @@ static int Open (vout_display_t *vd, const vout_display_cfg_t *cfg,
 
     if (!sys)
         return VLC_ENOMEM;
-    sys->cfg = *cfg;
 
     @autoreleasepool {
         if (!CGDisplayUsesOpenGLAcceleration (kCGDirectMainDisplay))
@@ -336,9 +333,9 @@ static void PictureDisplay (vout_display_t *vd, picture_t *pic)
     {
         if (@available(macOS 10.14, *)) {
             vout_display_place_t place;
-            vout_display_PlacePicture(&place, vd->source, &sys->cfg);
+            vout_display_PlacePicture(&place, vd->source, vd->cfg);
             vout_display_opengl_Viewport(vd->sys->vgl, place.x,
-                                         sys->cfg.display.height - (place.y + place.height),
+                                         vd->cfg->display.height - (place.y + place.height),
                                          place.width, place.height);
         }
 
@@ -377,9 +374,6 @@ static int Control (vout_display_t *vd, int query)
 
                 vout_display_place_t place;
                 vout_display_PlacePicture(&place, vd->source, &cfg_tmp);
-                @synchronized (sys->glView) {
-                    sys->cfg = *vd->cfg;
-                }
 
                 if (vlc_gl_MakeCurrent (sys->gl) != VLC_SUCCESS)
                     return VLC_SUCCESS;
@@ -634,11 +628,11 @@ static void OpenglSwap (vlc_gl_t *gl)
 
     @synchronized(self) {
         if (vd) {
-            vout_display_sys_t *sys = vd->sys;
-            sys->cfg.display.width  = bounds.size.width;
-            sys->cfg.display.height = bounds.size.height;
+            vout_display_cfg_t cfg_tmp = *vd->cfg;
+            cfg_tmp.width  = bounds.size.width;
+            cfg_tmp.height = bounds.size.height;
 
-            vout_display_PlacePicture(&place, vd->source, &sys->cfg);
+            vout_display_PlacePicture(&place, vd->source, &cfg_tmp);
             // FIXME: this call leads to a fatal mutex locking error in vout_ChangeDisplaySize()
             // vout_window_ReportSize(sys->embed, bounds.size.width, bounds.size.height);
         }
-- 
2.26.2



More information about the vlc-devel mailing list