summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfaust3 <faust3@b3059339-0415-0410-9bf9-f77b7e298cf2>2004-04-07 17:53:42 +0000
committerfaust3 <faust3@b3059339-0415-0410-9bf9-f77b7e298cf2>2004-04-07 17:53:42 +0000
commita07c26e7dd28b81a40cfe1f9bb000b02bef762fe (patch)
treecca0bfbcb685de5b5c92b109c6a9b918717b6dc5
parent3905f57aaf7eefc01e8fdfdeb352c99dc0e12459 (diff)
downloadmpv-a07c26e7dd28b81a40cfe1f9bb000b02bef762fe.tar.bz2
mpv-a07c26e7dd28b81a40cfe1f9bb000b02bef762fe.tar.xz
round len to outburst and increment full_buffers at the correct time, patch by Nehal <nehalmistry at gmx.net>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12152 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--libao2/ao_sdl.c4
-rw-r--r--libao2/ao_win32.c5
2 files changed, 6 insertions, 3 deletions
diff --git a/libao2/ao_sdl.c b/libao2/ao_sdl.c
index 115eef130b..7749b51946 100644
--- a/libao2/ao_sdl.c
+++ b/libao2/ao_sdl.c
@@ -66,12 +66,13 @@ static int write_buffer(unsigned char* data,int len){
x=BUFFSIZE-buf_write_pos;
if(x>len) x=len;
memcpy(buffer[buf_write]+buf_write_pos,data+len2,x);
+ if (buf_write_pos==0)
+ ++full_buffers;
len2+=x; len-=x;
buffered_bytes+=x; buf_write_pos+=x;
if(buf_write_pos>=BUFFSIZE){
// block is full, find next!
buf_write=(buf_write+1)%NUM_BUFS;
- ++full_buffers;
buf_write_pos=0;
}
}
@@ -316,6 +317,7 @@ static int get_space(){
// return: number of bytes played
static int play(void* data,int len,int flags){
+ len = (len/ao_data.outburst)*ao_data.outburst;
#if 0
int ret;
diff --git a/libao2/ao_win32.c b/libao2/ao_win32.c
index d439c5f5c5..e99249d3ac 100644
--- a/libao2/ao_win32.c
+++ b/libao2/ao_win32.c
@@ -1,6 +1,6 @@
/******************************************************************************
* ao_win32.c: Windows waveOut interface for MPlayer
- * Copyright (c) 2002 Sascha Sommer <saschasommer@freenet.de>.
+ * Copyright (c) 2002 - 2004 Sascha Sommer <saschasommer@freenet.de>.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -220,6 +220,7 @@ static int write_waveOutBuffer(unsigned char* data,int len){
x=BUFFER_SIZE-buf_write_pos;
if(x>len) x=len;
memcpy(current->lpData+buf_write_pos,data+len2,x);
+ if(buf_write_pos==0)full_buffers++;
len2+=x; len-=x;
buffered_bytes+=x; buf_write_pos+=x;
//prepare header and write data to device
@@ -230,7 +231,6 @@ static int write_waveOutBuffer(unsigned char* data,int len){
if(buf_write_pos>=BUFFER_SIZE){ //buffer is full find next
// block is full, find next!
buf_write=(buf_write+1)%BUFFER_COUNT;
- ++full_buffers;
buf_write_pos=0;
}
}
@@ -242,6 +242,7 @@ static int write_waveOutBuffer(unsigned char* data,int len){
// return: number of bytes played
static int play(void* data,int len,int flags)
{
+ len = (len/ao_data.outburst)*ao_data.outburst;
return write_waveOutBuffer(data,len);
}