Fixed sig 11 caused by buffer full in ao driver

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4376 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
anders 2002-01-27 10:59:03 +00:00
parent c045148761
commit f7737ca1e0
1 changed files with 20 additions and 16 deletions

View File

@ -217,22 +217,26 @@ static int play(void* data,int len,int flags){
// Limit length to avoid over flow in plugins // Limit length to avoid over flow in plugins
int tmp = driver()->get_space(); int tmp = driver()->get_space();
int ret_len =(tmp<len)?tmp:len; int ret_len =(tmp<len)?tmp:len;
// Filter data if(ret_len){
ao_plugin_data.len=ret_len; // Filter data
ao_plugin_data.data=data; ao_plugin_data.len=ret_len;
while(plugin(i)) ao_plugin_data.data=data;
plugin(i++)->play(); while(plugin(i)){
// Copy data to output buffer printf("%i \n",ao_plugin_data.len);
memcpy(ao_plugin_local_data.buf+ao_plugin_local_data.len, plugin(i++)->play();
ao_plugin_data.data,ao_plugin_data.len); printf("%i \n",ao_plugin_data.len);
// Send data to output }
l=driver()->play(ao_plugin_local_data.buf, // Copy data to output buffer
ao_plugin_data.len+ao_plugin_local_data.len,flags); memcpy(ao_plugin_local_data.buf+ao_plugin_local_data.len,
// Save away unsent data ao_plugin_data.data,ao_plugin_data.len);
ao_plugin_local_data.len=ao_plugin_data.len+ao_plugin_local_data.len-l; // Send data to output
memcpy(ao_plugin_local_data.buf,ao_plugin_local_data.buf+l, l=driver()->play(ao_plugin_local_data.buf,
ao_plugin_local_data.len); ao_plugin_data.len+ao_plugin_local_data.len,flags);
// Save away unsent data
ao_plugin_local_data.len=ao_plugin_data.len+ao_plugin_local_data.len-l;
memcpy(ao_plugin_local_data.buf,ao_plugin_local_data.buf+l,
ao_plugin_local_data.len);
}
return ret_len; return ret_len;
} }