[vlc-devel] [PATCH 4/7] video_output: simplify the locking of the display in vout_UpdateWindowSizeLocked

Steve Lhomme robux4 at ycbcr.xyz
Wed Oct 9 17:36:46 CEST 2019


---
 src/video_output/video_output.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index e8ee9572188..0f32377a0c4 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -201,15 +201,18 @@ static void vout_UpdateWindowSizeLocked(vout_thread_t *vout)
 
     vlc_mutex_assert(&sys->window_lock);
 
+    bool new_size = false;
     vlc_mutex_lock(&sys->display_lock);
-    if (sys->display != NULL) {
+    if (sys->display != NULL)
+    {
+        new_size = true;
         vout_SizeWindow(vout, &width, &height);
-        vlc_mutex_unlock(&sys->display_lock);
-
         msg_Dbg(vout, "requested window size: %ux%u", width, height);
+    }
+    vlc_mutex_unlock(&sys->display_lock);
+
+    if (new_size)
         vout_window_SetSize(vout->p->display_cfg.window, width, height);
-    } else
-        vlc_mutex_unlock(&sys->display_lock);
 }
 
 /* */
-- 
2.17.1



More information about the vlc-devel mailing list