Added check to alsa backend for QAudioOutput
authorKurt Korbatits <kurt.korbatits@nokia.com>
Wed, 25 Jul 2012 02:28:23 +0000 (12:28 +1000)
committerQt by Nokia <qt-info@nokia.com>
Thu, 26 Jul 2012 03:31:01 +0000 (05:31 +0200)
- Was asserting when stop() called when in IdleState

Change-Id: Ib8a5bd149c0b9c700c709520cf8ffdd237e08694
Reviewed-by: Ling Hu <ling.hu@nokia.com>
Reviewed-by: Kurt Korbatits <kurt.korbatits@nokia.com>
src/multimedia/audio/qaudiooutput_alsa_p.cpp

index e80cf15..c9400ba 100644 (file)
@@ -747,6 +747,11 @@ bool QAudioOutputPrivate::deviceReady()
         if(input > (int)buffer_frames)
             input = buffer_frames;
         l = audioSource->read(audioBuffer,snd_pcm_frames_to_bytes(handle, input));
+
+        // reading can take a while and stream may have been stopped
+        if (!handle)
+            return false;
+
         if(l > 0) {
             // Got some data to output
             if(deviceState != QAudio::ActiveState)