From c0286b3ab4a0982000756fd32d607f50889ffe02 Mon Sep 17 00:00:00 2001 From: Johns Date: Mon, 15 Apr 2013 16:55:15 +0200 Subject: Fix "broken driver" message if empty ring buffer. --- audio.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'audio.c') diff --git a/audio.c b/audio.c index fa518d5..a38377d 100644 --- a/audio.c +++ b/audio.c @@ -2033,10 +2033,10 @@ static void *AudioPlayHandlerThread(void *dummy) pthread_mutex_unlock(&AudioMutex); Debug(3, "audio: ----> %dms start\n", (AudioUsedBytes() * 1000) - / (!AudioRing[AudioRingRead].HwSampleRate + - !AudioRing[AudioRingRead].HwChannels + - AudioRing[AudioRingRead].HwSampleRate * - AudioRing[AudioRingRead].HwChannels * AudioBytesProSample)); + / (!AudioRing[AudioRingWrite].HwSampleRate + + !AudioRing[AudioRingWrite].HwChannels + + AudioRing[AudioRingWrite].HwSampleRate * + AudioRing[AudioRingWrite].HwChannels * AudioBytesProSample)); do { int filled; @@ -2069,7 +2069,10 @@ static void *AudioPlayHandlerThread(void *dummy) Debug(3, "audio: continue after flush\n"); } // try to play some samples - err = AudioUsedModule->Thread(); + err = 0; + if (RingBufferUsedBytes(AudioRing[AudioRingRead].RingBuffer)) { + err = AudioUsedModule->Thread(); + } // underrun, check if new ring buffer is available if (!err) { int passthrough; -- cgit v1.2.3