changeset 4375:bd108c2796ab

Fixed sig 11 caused by buffer full in ao driver
author anders
date Sun, 27 Jan 2002 10:59:03 +0000
parents 0a95c5074c50
children 118ae69769be
files libao2/ao_plugin.c
diffstat 1 files changed, 20 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/libao2/ao_plugin.c	Sun Jan 27 10:41:43 2002 +0000
+++ b/libao2/ao_plugin.c	Sun Jan 27 10:59:03 2002 +0000
@@ -217,22 +217,26 @@
   // Limit length to avoid over flow in plugins
   int tmp = driver()->get_space();
   int ret_len =(tmp<len)?tmp:len;
-  // Filter data
-  ao_plugin_data.len=ret_len;
-  ao_plugin_data.data=data;
-  while(plugin(i))
-    plugin(i++)->play();
-  // Copy data to output buffer
-  memcpy(ao_plugin_local_data.buf+ao_plugin_local_data.len,
-	 ao_plugin_data.data,ao_plugin_data.len);
-  // Send data to output
-  l=driver()->play(ao_plugin_local_data.buf,
-		   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);
-  
+  if(ret_len){
+    // Filter data
+    ao_plugin_data.len=ret_len;
+    ao_plugin_data.data=data;
+    while(plugin(i)){
+      printf("%i  \n",ao_plugin_data.len);
+      plugin(i++)->play();
+      printf("%i  \n",ao_plugin_data.len);
+    }
+    // Copy data to output buffer
+    memcpy(ao_plugin_local_data.buf+ao_plugin_local_data.len,
+	   ao_plugin_data.data,ao_plugin_data.len);
+    // Send data to output
+    l=driver()->play(ao_plugin_local_data.buf,
+		     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;
 }