[vlc-devel] [PATCH 05/13] vout: set display filled synchronously

RĂ©mi Denis-Courmont remi at remlab.net
Wed Jun 12 19:48:29 CEST 2019


This fixes an ABBA race if two threads set the flag simultaneously.
---
 src/video_output/control.h      |  1 -
 src/video_output/video_output.c | 12 +++++-------
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/video_output/control.h b/src/video_output/control.h
index b189b6478a..a384afa2c6 100644
--- a/src/video_output/control.h
+++ b/src/video_output/control.h
@@ -32,7 +32,6 @@ enum {
 
     VOUT_CONTROL_MOUSE_STATE,           /* vlc_mouse_t */
     VOUT_CONTROL_DISPLAY_SIZE,          /* window */
-    VOUT_CONTROL_DISPLAY_FILLED,        /* bool */
     VOUT_CONTROL_ZOOM,                  /* pair */
 
     VOUT_CONTROL_ASPECT_RATIO,          /* pair */
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index ca9831e086..af2c0ecf8d 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -433,10 +433,13 @@ void vout_ChangeDisplayFilled(vout_thread_t *vout, bool is_filled)
     vlc_mutex_lock(&sys->window_lock);
     sys->display_cfg.is_display_filled = is_filled;
     /* no window size update here */
+
+    vlc_mutex_lock(&sys->display_lock);
     vlc_mutex_unlock(&sys->window_lock);
 
-    vout_control_PushBool(&vout->p->control, VOUT_CONTROL_DISPLAY_FILLED,
-                          is_filled);
+    if (sys->display != NULL)
+        vout_SetDisplayFilled(sys->display, is_filled);
+    vlc_mutex_unlock(&sys->display_lock);
 }
 
 void vout_ChangeZoom(vout_thread_t *vout, unsigned num, unsigned den)
@@ -1573,11 +1576,6 @@ static void ThreadControl(vout_thread_t *vout, vout_control_cmd_t cmd)
                              cmd.window.width, cmd.window.height);
         vlc_mutex_unlock(&vout->p->display_lock);
         break;
-    case VOUT_CONTROL_DISPLAY_FILLED:
-        vlc_mutex_lock(&vout->p->display_lock);
-        vout_SetDisplayFilled(vout->p->display, cmd.boolean);
-        vlc_mutex_unlock(&vout->p->display_lock);
-        break;
     case VOUT_CONTROL_ZOOM:
         vlc_mutex_lock(&vout->p->display_lock);
         vout_SetDisplayZoom(vout->p->display, cmd.pair.a, cmd.pair.b);
-- 
2.20.1



More information about the vlc-devel mailing list