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

Steve Lhomme robux4 at ycbcr.xyz
Tue Nov 3 08:46:47 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 a8e3f81eb9c..68bb1a36c1d 100644
--- a/modules/video_output/macosx.m
+++ b/modules/video_output/macosx.m
@@ -120,8 +120,6 @@ struct vout_display_sys_t
 
     picture_t *current;
     bool has_first_frame;
-
-    vout_display_cfg_t cfg;
 };
 
 struct gl_sys
@@ -157,7 +155,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))
@@ -342,9 +339,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);
         }
 
@@ -383,9 +380,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;
@@ -654,11 +648,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.display.width  = bounds.size.width;
+            cfg_tmp.display.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