[MPlayer-cvslog] r25222 - trunk/libao2/ao_null.c
uau
subversion at mplayerhq.hu
Sat Dec 1 02:39:39 CET 2007
Author: uau
Date: Sat Dec 1 02:39:39 2007
New Revision: 25222
Log:
ao_null: Make duration of "buffered" audio constant
Choose the "buffer size" for the amount of audio the driver accepts so
that it corresponds to about 0.2 seconds of playback based on the
number of channels, sample size and samplerate.
Modified:
trunk/libao2/ao_null.c
Modified: trunk/libao2/ao_null.c
==============================================================================
--- trunk/libao2/ao_null.c (original)
+++ trunk/libao2/ao_null.c Sat Dec 1 02:39:39 2007
@@ -50,14 +50,14 @@ static int control(int cmd,void *arg){
// return: 1=success 0=fail
static int init(int rate,int channels,int format,int flags){
- ao_data.buffersize= 16384*channels;
- ao_data.outburst=512*channels;
+ int samplesize = (format == AF_FORMAT_U8 || format == AF_FORMAT_S8) ? 1: 2;
+ ao_data.outburst = 256 * channels * samplesize;
+ // A "buffer" for about 0.2 seconds of audio
+ ao_data.buffersize = (int)(rate * 0.2 / 256 + 1) * ao_data.outburst;
ao_data.channels=channels;
ao_data.samplerate=rate;
ao_data.format=format;
- ao_data.bps=channels*rate;
- if (format != AF_FORMAT_U8 && format != AF_FORMAT_S8)
- ao_data.bps*=2;
+ ao_data.bps=channels*rate*samplesize;
buffer=0;
gettimeofday(&last_tv, 0);
More information about the MPlayer-cvslog
mailing list