[MPlayer-cvslog] CVS: main mplayer.c,1.939,1.940

Roberto Togni CVS syncmail at mplayerhq.hu
Mon Apr 24 12:26:22 CEST 2006


CVS change done by Roberto Togni CVS

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

Modified Files:
	mplayer.c 
Log Message:
1 - Remove kernel HZ=100 assumptions that are no longer true from
timing.

Patch by Uoti Urpala


Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.939
retrieving revision 1.940
diff -u -r1.939 -r1.940
--- mplayer.c	24 Apr 2006 07:20:32 -0000	1.939
+++ mplayer.c	24 Apr 2006 10:26:19 -0000	1.940
@@ -3789,15 +3789,14 @@
 #else
     {
 	// -------- TIMER + SOFTSLEEP -----------
-	float min=softsleep?0.021:0.005;
+	// assume kernel HZ=100 for softsleep, works with larger HZ but with
+	// unnecessarily high CPU usage
+	float margin = softsleep ? 0.011 : 0;
 	current_module="sleep_timer";
-        while(time_frame>min){
-          if(time_frame<=0.020)
-             usec_sleep(0); // sleeps 1 clock tick (10ms)!
-          else
-             usec_sleep(1000000*(time_frame-0.020));
-          time_frame-=GetRelativeTime();
-        }
+	while (time_frame > margin) {
+	    usec_sleep(1000000 * (time_frame - margin));
+	    time_frame -= GetRelativeTime();
+	}
 	if(softsleep){
 	    current_module="sleep_soft";
 	    if(time_frame<0) mp_msg(MSGT_AVSYNC, MSGL_WARN, MSGTR_SoftsleepUnderflow);




More information about the MPlayer-cvslog mailing list