summaryrefslogtreecommitdiffstats
path: root/libao2
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-03-06 18:50:50 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-03-06 18:50:50 +0000
commit7ee7bd3d5b72ad6480f7b9adf08e34b572e7c287 (patch)
treed546225abb97d99a609813ad6d6195b6421de884 /libao2
parent79df4b2499ab2384bf92132c03563cf88bf623b2 (diff)
downloadmpv-7ee7bd3d5b72ad6480f7b9adf08e34b572e7c287.tar.bz2
mpv-7ee7bd3d5b72ad6480f7b9adf08e34b572e7c287.tar.xz
Always write full buffers in ao_win32, except for the last block.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28853 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libao2')
-rw-r--r--libao2/ao_win32.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/libao2/ao_win32.c b/libao2/ao_win32.c
index 29ecfef23c..492a36eb34 100644
--- a/libao2/ao_win32.c
+++ b/libao2/ao_win32.c
@@ -172,6 +172,7 @@ static int init(int rate,int channels,int format,int flags)
ao_data.bps=channels*rate;
if(format != AF_FORMAT_U8 && format != AF_FORMAT_S8)
ao_data.bps*=2;
+ ao_data.outburst = BUFFER_SIZE;
if(ao_data.buffersize==-1)
{
ao_data.buffersize=af_fmt2bits(format)/8;
@@ -298,22 +299,18 @@ static int write_waveOutBuffer(unsigned char* data,int len){
//unprepare the header if it is prepared
if(current->dwFlags & WHDR_PREPARED)
waveOutUnprepareHeader(hWaveOut, current, sizeof(WAVEHDR));
- x=BUFFER_SIZE-buf_write_pos;
+ x=BUFFER_SIZE;
if(x>len) x=len;
fast_memcpy(current->lpData+buf_write_pos,data+len2,x);
- if(buf_write_pos==0)full_buffers++;
+ full_buffers++;
len2+=x; len-=x;
- buffered_bytes+=x; buf_write_pos+=x;
+ buffered_bytes+=x;
//prepare header and write data to device
- current->dwBufferLength = buf_write_pos;
+ current->dwBufferLength = x;
waveOutPrepareHeader(hWaveOut, current, sizeof(WAVEHDR));
waveOutWrite(hWaveOut, current, sizeof(WAVEHDR));
- if(buf_write_pos>=BUFFER_SIZE){ //buffer is full find next
- // block is full, find next!
buf_write=(buf_write+1)%BUFFER_COUNT;
- buf_write_pos=0;
- }
}
return len2;
}