[vlc-devel] [PATCH v2 6/7] vout/control: reverse the condition to wait until the deadline

Steve Lhomme robux4 at ycbcr.xyz
Fri Aug 14 11:57:31 CEST 2020


If there's no deadline, there's no reason to even try, regardless of the size
of the command queue.

The second 'if' corresponds to the conditions changed when signaling
wait_request.
---
 src/video_output/control.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/video_output/control.c b/src/video_output/control.c
index 93bf7c3f92a..6f038255738 100644
--- a/src/video_output/control.c
+++ b/src/video_output/control.c
@@ -134,9 +134,9 @@ int vout_control_Pop(vout_control_t *ctrl, vout_control_cmd_t *cmd,
 {
     vlc_mutex_lock(&ctrl->lock);
 
-    if (ctrl->cmd.i_size <= 0) {
+    if (deadline != INVALID_DEADLINE) {
         /* Spurious wakeups are perfectly fine */
-        if (deadline != INVALID_DEADLINE && ctrl->can_sleep) {
+        if (ctrl->cmd.i_size <= 0 && ctrl->can_sleep) {
             vlc_cond_timedwait(&ctrl->wait_request, &ctrl->lock, deadline);
         }
     }
-- 
2.26.2



More information about the vlc-devel mailing list