[vlc-commits] vout: refactor deadline computation for cond_timedwait in vout_control_Pop

Felix Abecassis git at videolan.org
Thu Feb 20 13:12:11 CET 2014


vlc | branch: master | Felix Abecassis <felix.abecassis at gmail.com> | Wed Feb 19 12:30:05 2014 +0100| [453264d4bc7ad9b60285b2eb237a84f76f279e20] | committer: Jean-Baptiste Kempf

vout: refactor deadline computation for cond_timedwait in vout_control_Pop

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 src/video_output/control.c |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/video_output/control.c b/src/video_output/control.c
index 7b4a19b..f317196 100644
--- a/src/video_output/control.c
+++ b/src/video_output/control.c
@@ -185,14 +185,11 @@ int vout_control_Pop(vout_control_t *ctrl, vout_control_cmd_t *cmd,
         vlc_cond_broadcast(&ctrl->wait_acknowledge);
 
         const mtime_t max_deadline = mdate() + timeout;
+        const mtime_t wait_deadline = deadline <= VLC_TS_INVALID ? max_deadline : __MIN(deadline, max_deadline);
 
         /* Spurious wakeups are perfectly fine */
-        if (ctrl->can_sleep) {
-            if (deadline <= VLC_TS_INVALID)
-                vlc_cond_timedwait(&ctrl->wait_request, &ctrl->lock, max_deadline);
-            else
-                vlc_cond_timedwait(&ctrl->wait_request, &ctrl->lock, __MIN(deadline, max_deadline));
-        }
+        if (ctrl->can_sleep)
+            vlc_cond_timedwait(&ctrl->wait_request, &ctrl->lock, wait_deadline);
     }
 
     bool has_cmd;



More information about the vlc-commits mailing list