[MPlayer-dev-eng] patch: Another stab at fixing problems with two buffer audio cards

Ed Wildgoose lists at wildgooses.com
Wed Oct 6 16:55:46 CEST 2004


Since my last patch seems to have languished, lets have another try at 
breaking this thing right down to something which is acceptable

The following patch:

a) removes the lower limit on out sleep time
b) makes the check for space free on the card a little more aggresive 
and work for double period soundcards rather than just 3+ period soundcards

Point a) might seem controversial, however, please remember that if you 
weren't coming up against the effects of that "if" statement before then 
you shouldn't be now either!  The only reason we will try to sleep for 
insanely short periods is because we need to sleep for insanely short 
periods to keep the audio card full of data.  So most people wouldn't of 
been needing it anyway, and people like me with pro audio cards, just 
couldn't run anything at all because at the moment we sleep for so long 
that I run out of audio data.  So having clarified that the "if" should 
have been redundant anyway, obviously this now gives people like me a 
fighting chance at getting mplayer to work, but still we need a kernel 
which can sleep for short time periods - that's a user issue...  
(However, there are plenty of low latency kernel choices out there).

Can you please test this fix and let me know if it does actually make 
things worse for anyone?  I can see no reason why it should though...

Thanks

Ed Wildgoose


--- mplayer.c.orig      2004-10-06 15:45:48.655104934 +0100
+++ mplayer.c   2004-10-06 15:46:47.191899202 +0100
@@ -2215,11 +2215,10 @@

        // delay = amount of audio buffered in soundcard/driver
        if(delay>0.25) delay=0.25; else
-       if(delay<0.10) delay=0.10;
-       if(time_frame>delay*0.6){
+       if(time_frame>delay*0.4){
            // sleep time too big - may cause audio drops (buffer underrun)
            frame_time_remaining=1;
-           time_frame=delay*0.5;
+           time_frame=delay*0.4;
        }

       } else {




More information about the MPlayer-dev-eng mailing list