[vlc-commits] vout: set display filled synchronously

Rémi Denis-Courmont git at videolan.org
Fri Jun 14 05:31:19 CEST 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Jun 12 19:34:50 2019 +0300| [200a686b878001d1cf34cdc49df9bb71b10e15a7] | committer: Rémi Denis-Courmont

vout: set display filled synchronously

This fixes an ABBA race if two threads set the flag simultaneously.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=200a686b878001d1cf34cdc49df9bb71b10e15a7
---

 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 082cf54f51..c8e436493e 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);



More information about the vlc-commits mailing list