[vlc-commits] vout: ensure strict sequence of window enable/disable

Rémi Denis-Courmont git at videolan.org
Sun Feb 24 15:17:37 CET 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Feb 24 16:13:45 2019 +0200| [798b775cb7b479e12c45b523a0d84c1f5da8b24f] | committer: Rémi Denis-Courmont

vout: ensure strict sequence of window enable/disable

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

 src/video_output/video_output.c  | 10 +++++++---
 src/video_output/vout_internal.h |  1 +
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 73a5fa5eb9..ac2a4060e7 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1597,7 +1597,10 @@ void vout_Stop(vout_thread_t *vout)
     vout_StopDisplay(vout);
 
     vlc_mutex_lock(&sys->window_lock);
-    vout_window_Disable(sys->display_cfg.window);
+    if (!sys->window_active) {
+        vout_window_Disable(sys->display_cfg.window);
+        sys->window_active = false;
+    }
     vlc_mutex_unlock(&sys->window_lock);
 }
 
@@ -1706,6 +1709,7 @@ vout_thread_t *vout_Create(vlc_object_t *object)
     sys->display_cfg.window = vout_display_window_New(vout);
     if (sys->splitter_name != NULL)
         var_Destroy(vout, "window");
+    sys->window_active = false;
     vlc_mutex_init(&sys->window_lock);
 
     /* Arbitrary initial time */
@@ -1759,12 +1763,11 @@ int vout_Request(const vout_configuration_t *cfg, input_thread_t *input)
     vout_ReinitInterlacingSupport(vout);
 
     vout_thread_sys_t *sys = vout->p;
-    bool enable = sys->original.i_chroma == 0;
 
     sys->original = original;
 
     vlc_mutex_lock(&sys->window_lock);
-    if (enable) {
+    if (!sys->window_active) {
         vout_window_cfg_t wcfg = {
             .is_fullscreen = var_GetBool(vout, "fullscreen"),
             .is_decorated = var_InheritBool(vout, "video-deco"),
@@ -1782,6 +1785,7 @@ int vout_Request(const vout_configuration_t *cfg, input_thread_t *input)
             vlc_mutex_unlock(&sys->window_lock);
             goto error;
         }
+        sys->window_active = true;
     } else
         vout_UpdateWindowSize(vout);
     vlc_mutex_unlock(&vout->p->window_lock);
diff --git a/src/video_output/vout_internal.h b/src/video_output/vout_internal.h
index 64605831ce..4b67be606e 100644
--- a/src/video_output/vout_internal.h
+++ b/src/video_output/vout_internal.h
@@ -160,6 +160,7 @@ struct vout_thread_sys_t
     void            *mouse_opaque;
 
     /* Video output window */
+    bool            window_active;
     vlc_mutex_t     window_lock;
 
     /* Video output display */



More information about the vlc-commits mailing list