[vlc-devel] [PATCH v5 3/9] video_output: remove the dead (don't push) control handling in video_output

Steve Lhomme robux4 at ycbcr.xyz
Fri Dec 18 10:21:26 UTC 2020


When vout_control_Dead() was called the vout thread was already dead. But
before that call happened, other threads may have been pushing commands in the
control FIFO. So this call only helped a bit.

In the end all previously enqueued commands will be ignored anyway. The control
FIFO will just be cleaned a few lines later in vout_Release().
---
 src/video_output/control.c      | 14 ++------------
 src/video_output/control.h      |  2 --
 src/video_output/video_output.c |  1 -
 3 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/src/video_output/control.c b/src/video_output/control.c
index fa5210bba9f..b22d0a03f66 100644
--- a/src/video_output/control.c
+++ b/src/video_output/control.c
@@ -38,7 +38,6 @@ void vout_control_Init(vout_control_t *ctrl)
 
     ctrl->is_held = false;
     ctrl->is_waiting = false;
-    ctrl->is_dead = false;
     ctrl->can_sleep = true;
     ARRAY_INIT(ctrl->cmd);
 }
@@ -49,20 +48,11 @@ void vout_control_Clean(vout_control_t *ctrl)
     ARRAY_RESET(ctrl->cmd);
 }
 
-void vout_control_Dead(vout_control_t *ctrl)
-{
-    vlc_mutex_lock(&ctrl->lock);
-    ctrl->is_dead = true;
-    vlc_mutex_unlock(&ctrl->lock);
-}
-
 static void vout_control_Push(vout_control_t *ctrl, vout_control_cmd_t *cmd)
 {
     vlc_mutex_lock(&ctrl->lock);
-    if (!ctrl->is_dead) {
-        ARRAY_APPEND(ctrl->cmd, *cmd);
-        vlc_cond_signal(&ctrl->wait_request);
-    }
+    ARRAY_APPEND(ctrl->cmd, *cmd);
+    vlc_cond_signal(&ctrl->wait_request);
     vlc_mutex_unlock(&ctrl->lock);
 }
 
diff --git a/src/video_output/control.h b/src/video_output/control.h
index 5976a0f6750..464bf349cc9 100644
--- a/src/video_output/control.h
+++ b/src/video_output/control.h
@@ -43,7 +43,6 @@ typedef struct {
     vlc_cond_t  wait_available;
 
     /* */
-    bool is_dead;
     bool can_sleep;
     bool is_waiting;
     bool is_held;
@@ -63,6 +62,5 @@ void vout_control_Release(vout_control_t *);
 
 /* control inside of the vout thread */
 int vout_control_Pop(vout_control_t *, vout_control_cmd_t *, vlc_tick_t deadline);
-void vout_control_Dead(vout_control_t *);
 
 #endif
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 29b8b140e09..b9ed2f49887 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -2010,7 +2010,6 @@ void vout_Close(vout_thread_t *vout)
 
     vout_IntfDeinit(VLC_OBJECT(vout));
     vout_snapshot_End(sys->snapshot);
-    vout_control_Dead(&sys->control);
     vout_chrono_Clean(&sys->render);
 
     if (sys->spu)
-- 
2.29.2



More information about the vlc-devel mailing list