[MPlayer-dev-eng] [PATCH] win32 ao

Joey Parrish joey at nicewarrior.org
Tue Nov 18 20:39:55 CET 2003


Hello,

The last in my round of patches!
This one is for win32 ao, and it fixes a bug in the fallback config
code.

If win32 ao configure fails, then it falls back on 44k S16_LE 2ch.
when it falls back, though, bps is not set consistently with the way
it would be from an original config of 44k S16_LE 2ch.

To reproduce, try -ao win32 -channels 6
or something like that your card won't support.
I get really terrible performance with this.

This patch fixes it.

original config:
> ao_data.bps=channels*rate;
> if(format != AFMT_U8 && format != AFMT_S8)
>   ao_data.bps*=2;

fallback:
> ao_data.bps=ao_data.channels * ao_data.samplerate;
then since we forced the format to S16_LE, we should double bps to be consistent.

Okay to commit?

--Joey

-- 
"I know Kung Fu." --Darth Vader
-------------- next part --------------
if win32_ao configure fails, then it falls back on 44k S16_LE 2ch.
when it falls back, though, bps is not set consistently with the way
it would be from an original config of 44k S16_LE 2ch.

this fixes it.

to reproduce, try -ao win32 -channels 6
 or something like that your card won't support.
 then watch the awful performance of the fallback settings.

original config:
> ao_data.bps=channels*rate;
> if(format != AFMT_U8 && format != AFMT_S8)
>   ao_data.bps*=2;

fallback:
> ao_data.bps=ao_data.channels * ao_data.samplerate;
then since we forced the format to S16_LE, we should double bps to be consistent.

--- main.sofar/libao2/ao_win32.c	2003-11-15 17:10:11.151182400 -0600
+++ main.dev/libao2/ao_win32.c	2003-11-15 18:11:25.995348800 -0600
@@ -134,7 +134,7 @@
         ao_data.channels = wformat.nChannels = 2;
 	    ao_data.samplerate = wformat.nSamplesPerSec = 44100;
 	    ao_data.format = AFMT_S16_LE;
-	    ao_data.bps=ao_data.channels * ao_data.samplerate;
+	    ao_data.bps=ao_data.channels * ao_data.samplerate*2;
 	    ao_data.buffersize=wformat.wBitsPerSample=16;
         wformat.nBlockAlign     = wformat.nChannels * (wformat.wBitsPerSample >> 3);
         wformat.nAvgBytesPerSec = wformat.nSamplesPerSec * wformat.nBlockAlign;


More information about the MPlayer-dev-eng mailing list