]> git.sesse.net Git - vlc/commitdiff
vout: remove flag is_sleeping from vout_control_t
authorFelix Abecassis <felix.abecassis@gmail.com>
Wed, 19 Feb 2014 11:30:03 +0000 (12:30 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Thu, 20 Feb 2014 12:10:32 +0000 (13:10 +0100)
Previously, the is_sleeping flag was not set to true if a deadline was
passed to vout_control_Pop. Consequently, the condition variable would
not be signalled by function vout_control_Wake, called by
vout_PutPicture to give a vout a picture to display. Thus, the vout
would not wake up even when receiving several pictures, instead the
vout waits until the end of the deadline. If the deadline was computed
as the "refresh" deadline from ThreadDisplayPicture, the sleep time
can be as high as 60-70 ms.

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
src/video_output/control.c
src/video_output/control.h

index 73877d51679c7a0ba8dfebb3ca8f1c1ec3bb27ea..bc7bda28e037affaad5b50f7e7a5c26130ee9bee 100644 (file)
@@ -62,7 +62,6 @@ void vout_control_Init(vout_control_t *ctrl)
     vlc_cond_init(&ctrl->wait_acknowledge);
 
     ctrl->is_dead = false;
-    ctrl->is_sleeping = false;
     ctrl->can_sleep = true;
     ctrl->is_processing = false;
     ARRAY_INIT(ctrl->cmd);
@@ -115,8 +114,7 @@ void vout_control_Wake(vout_control_t *ctrl)
 {
     vlc_mutex_lock(&ctrl->lock);
     ctrl->can_sleep = false;
-    if (ctrl->is_sleeping)
-        vlc_cond_signal(&ctrl->wait_request);
+    vlc_cond_signal(&ctrl->wait_request);
     vlc_mutex_unlock(&ctrl->lock);
 }
 
@@ -190,10 +188,8 @@ int vout_control_Pop(vout_control_t *ctrl, vout_control_cmd_t *cmd,
 
         /* Spurious wakeups are perfectly fine */
         if (deadline <= VLC_TS_INVALID) {
-            ctrl->is_sleeping = true;
             if (ctrl->can_sleep)
                 vlc_cond_timedwait(&ctrl->wait_request, &ctrl->lock, max_deadline);
-            ctrl->is_sleeping = false;
         } else {
             vlc_cond_timedwait(&ctrl->wait_request, &ctrl->lock, __MIN(deadline, max_deadline));
         }
index 3d66793c48e592cc0600addcf280268e44283da8..f52a529c3a2d2f46668f7c496763498084e024b1 100644 (file)
@@ -107,7 +107,6 @@ typedef struct {
 
     /* */
     bool is_dead;
-    bool is_sleeping;
     bool can_sleep;
     bool is_processing;
     DECL_ARRAY(vout_control_cmd_t) cmd;