[MPlayer-cvslog] CVS: main/osdep timer-darwin.c,1.5,1.6

Nicolas Plourde CVS syncmail at mplayerhq.hu
Wed Apr 27 16:55:33 CEST 2005


CVS change done by Nicolas Plourde CVS

Update of /cvsroot/mplayer/main/osdep
In directory mail:/var2/tmp/cvs-serv21812/osdep

Modified Files:
	timer-darwin.c 
Log Message:
use sleep_accurate darwin timer

Index: timer-darwin.c
===================================================================
RCS file: /cvsroot/mplayer/main/osdep/timer-darwin.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- timer-darwin.c	27 Oct 2004 18:03:11 -0000	1.5
+++ timer-darwin.c	27 Apr 2005 14:55:30 -0000	1.6
@@ -34,10 +34,20 @@
 
 
 
+/* the core sleep function, uses floats and is used in MPlayer G2 */
+float sleep_accurate(float time_frame)
+{
+	uint64_t deadline = time_frame / timebase_ratio + mach_absolute_time();
+	
+	mach_wait_until(deadline);
+	
+	return (mach_absolute_time() - deadline) * timebase_ratio;
+}
+
 /* wrapper for MPlayer G1 */
 int usec_sleep(int usec_delay)
 {
-  return usleep(usec_delay);
+  return sleep_accurate(usec_delay / 1e6) * 1e6;
 }
 
 




More information about the MPlayer-cvslog mailing list