changeset 34153:54f502c57425

Fix possible crash since RenderCallbackSPDIF might call read_buffer with NULL data. The purpose of that is to drain data from the buffer when the output is muted.
author reimar
date Sun, 23 Oct 2011 12:03:13 +0000
parents eff0c15389be
children a42d4bc441d7
files libao2/ao_coreaudio.c
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libao2/ao_coreaudio.c	Sun Oct 23 12:00:24 2011 +0000
+++ b/libao2/ao_coreaudio.c	Sun Oct 23 12:03:13 2011 +0000
@@ -133,7 +133,10 @@
 static int read_buffer(unsigned char* data,int len){
   int buffered = av_fifo_size(ao->buffer);
   if (len > buffered) len = buffered;
+  if (data)
   av_fifo_generic_read(ao->buffer, data, len, NULL);
+  else
+    av_fifo_drain(ao->buffer, len);
   return len;
 }