Mercurial > mplayer.hg
changeset 18240:da3115996a81
1 - Remove kernel HZ=100 assumptions that are no longer true from
timing.
Patch by Uoti Urpala
author | rtognimp |
---|---|
date | Mon, 24 Apr 2006 10:26:19 +0000 |
parents | c1579a060477 |
children | b19dada1aeeb |
files | mplayer.c |
diffstat | 1 files changed, 7 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mplayer.c Mon Apr 24 10:24:56 2006 +0000 +++ b/mplayer.c Mon Apr 24 10:26:19 2006 +0000 @@ -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);