[vlc-commits] auhal: prevent assertion failure on TPCircularBufferClear (close #10109)
Felix Paul Kühne
git at videolan.org
Thu Dec 26 17:44:50 CET 2013
vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Thu Dec 26 17:43:09 2013 +0100| [264f837c23f4fa58df49f457ba52c00b255fe155] | committer: Felix Paul Kühne
auhal: prevent assertion failure on TPCircularBufferClear (close #10109)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=264f837c23f4fa58df49f457ba52c00b255fe155
---
modules/audio_output/auhal.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/modules/audio_output/auhal.c b/modules/audio_output/auhal.c
index f2d3643..c421fe6 100644
--- a/modules/audio_output/auhal.c
+++ b/modules/audio_output/auhal.c
@@ -1379,20 +1379,22 @@ static void Flush(audio_output_t *p_aout, bool wait)
{
struct aout_sys_t *p_sys = p_aout->sys;
+ int32_t availableBytes;
+ vlc_mutex_lock(&p_sys->lock);
+ TPCircularBufferTail(&p_sys->circular_buffer, &availableBytes);
+
if (wait) {
- int32_t availableBytes;
- vlc_mutex_lock(&p_sys->lock);
- TPCircularBufferTail(&p_sys->circular_buffer, &availableBytes);
while (availableBytes > 0) {
vlc_cond_wait(&p_sys->cond, &p_sys->lock);
TPCircularBufferTail(&p_sys->circular_buffer, &availableBytes);
}
- vlc_mutex_unlock(&p_sys->lock);
-
} else {
- /* flush circular buffer */
- TPCircularBufferClear(&p_aout->sys->circular_buffer);
+ /* flush circular buffer if data is left */
+ if (availableBytes > 0)
+ TPCircularBufferClear(&p_aout->sys->circular_buffer);
}
+
+ vlc_mutex_unlock(&p_sys->lock);
}
static int TimeGet(audio_output_t *p_aout, mtime_t *delay)
More information about the vlc-commits
mailing list