[vlc-commits] snapshot: remove redundant deadline check

Rémi Denis-Courmont git at videolan.org
Fri Jul 10 17:34:24 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Jul 10 18:33:32 2015 +0300| [0a7e31db08a04cbb6519b44d1162e39739507a15] | committer: Rémi Denis-Courmont

snapshot: remove redundant deadline check

vlc_cond_timedwait() returns non-zero when the deadline is reached.

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

 src/video_output/snapshot.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/video_output/snapshot.c b/src/video_output/snapshot.c
index 7b89803..7c8b527 100644
--- a/src/video_output/snapshot.c
+++ b/src/video_output/snapshot.c
@@ -78,15 +78,16 @@ void vout_snapshot_End(vout_snapshot_t *snap)
 /* */
 picture_t *vout_snapshot_Get(vout_snapshot_t *snap, mtime_t timeout)
 {
+    const mtime_t deadline = mdate() + timeout;
+
     vlc_mutex_lock(&snap->lock);
 
     /* */
     snap->request_count++;
 
     /* */
-    const mtime_t deadline = mdate() + timeout;
-    while (snap->is_available && !snap->picture && mdate() < deadline)
-        vlc_cond_timedwait(&snap->wait, &snap->lock, deadline);
+    while (snap->is_available && !snap->picture &&
+        vlc_cond_timedwait(&snap->wait, &snap->lock, deadline) == 0);
 
     /* */
     picture_t *picture = snap->picture;



More information about the vlc-commits mailing list