diff options
-rw-r--r-- | examples/multimedia/audioinput/audioinput.cpp | 5 | ||||
-rw-r--r-- | src/multimedia/audio/qaudioinput_mac_p.cpp | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/examples/multimedia/audioinput/audioinput.cpp b/examples/multimedia/audioinput/audioinput.cpp index 4a408a0..4e5f2a3 100644 --- a/examples/multimedia/audioinput/audioinput.cpp +++ b/examples/multimedia/audioinput/audioinput.cpp @@ -315,6 +315,11 @@ void InputTest::readMore() void InputTest::toggleMode() { // Change bewteen pull and push modes + if (m_input != 0) { + disconnect(m_input, 0, this, 0); + m_input = 0; + } + m_audioInput->stop(); if (m_pullMode) { diff --git a/src/multimedia/audio/qaudioinput_mac_p.cpp b/src/multimedia/audio/qaudioinput_mac_p.cpp index cb65f6e..b99fe11 100644 --- a/src/multimedia/audio/qaudioinput_mac_p.cpp +++ b/src/multimedia/audio/qaudioinput_mac_p.cpp @@ -259,7 +259,7 @@ public: UInt32 inBusNumber, UInt32 inNumberFrames) { - const bool wasEmpty = m_buffer->used() == 0; + const bool pullMode = m_device == 0; OSStatus err; qint64 framesRendered = 0; @@ -330,7 +330,7 @@ public: framesRendered = copied / m_outputFormat.mBytesPerFrame; } - if (wasEmpty && framesRendered > 0) + if (pullMode && framesRendered > 0) emit readyRead(); return framesRendered; |