diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2011-10-23 12:03:13 +0000 |
---|---|---|
committer | Uoti Urpala <uau@mplayer2.org> | 2011-11-25 05:20:23 +0200 |
commit | 9fae75b81ce2eb475db7652083b388e704833a72 (patch) | |
tree | 8f666b628975e153a0f8f2e3031e24fa5dd7bc2f /libao2 | |
parent | 075edf91f1d9d8dac2aec2d132bee90fffd41e27 (diff) | |
download | mpv-9fae75b81ce2eb475db7652083b388e704833a72.tar.bz2 mpv-9fae75b81ce2eb475db7652083b388e704833a72.tar.xz |
ao_coreaudio: fix crash when using mute with S/PDIF output
RenderCallbackSPDIF might call read_buffer with NULL data. The purpose
is to drain data from the buffer when the output is muted. Add a check
to call av_fifo_drain() in this case.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34241 b3059339-0415-0410-9bf9-f77b7e298cf2
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34242 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libao2')
-rw-r--r-- | libao2/ao_coreaudio.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libao2/ao_coreaudio.c b/libao2/ao_coreaudio.c index 61323c1129..34374f4c9c 100644 --- a/libao2/ao_coreaudio.c +++ b/libao2/ao_coreaudio.c @@ -133,7 +133,10 @@ static int write_buffer(unsigned char* data, int len){ static int read_buffer(unsigned char* data,int len){ int buffered = av_fifo_size(ao->buffer); if (len > buffered) len = buffered; - av_fifo_generic_read(ao->buffer, data, len, NULL); + if (data) + av_fifo_generic_read(ao->buffer, data, len, NULL); + else + av_fifo_drain(ao->buffer, len); return len; } |