diff options
author | Justin McPherson <justin.mcpherson@nokia.com> | 2010-03-15 05:21:45 (GMT) |
---|---|---|
committer | Justin McPherson <justin.mcpherson@nokia.com> | 2010-03-16 03:46:45 (GMT) |
commit | 1c5f43489f7c2e47dd602307570dd6235355da9d (patch) | |
tree | c0a7dae6390fc02e8874f27c8417e22f6d4ce466 | |
parent | 3f41524598f5b4795f0f6b279450daf792df927d (diff) | |
download | Qt-1c5f43489f7c2e47dd602307570dd6235355da9d.zip Qt-1c5f43489f7c2e47dd602307570dd6235355da9d.tar.gz Qt-1c5f43489f7c2e47dd602307570dd6235355da9d.tar.bz2 |
Handle values passed to setNotifyInterval more robustly.
Reviewed-by:Dmytro Poplavskiy
-rw-r--r-- | src/multimedia/audio/qaudioinput_mac_p.cpp | 9 | ||||
-rw-r--r-- | src/multimedia/audio/qaudiooutput_mac_p.cpp | 9 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/multimedia/audio/qaudioinput_mac_p.cpp b/src/multimedia/audio/qaudioinput_mac_p.cpp index 7ab8c27..1db5866 100644 --- a/src/multimedia/audio/qaudioinput_mac_p.cpp +++ b/src/multimedia/audio/qaudioinput_mac_p.cpp @@ -807,6 +807,12 @@ int QAudioInputPrivate::bufferSize() const void QAudioInputPrivate::setNotifyInterval(int milliSeconds) { + if (intervalTimer->interval() == milliSeconds) + return; + + if (milliSeconds <= 0) + milliSeconds = 0; + intervalTimer->setInterval(milliSeconds); } @@ -886,7 +892,8 @@ void QAudioInputPrivate::audioDeviceError() void QAudioInputPrivate::startTimers() { audioBuffer->startFlushTimer(); - intervalTimer->start(); + if (intervalTimer->interval() > 0) + intervalTimer->start(); } void QAudioInputPrivate::stopTimers() diff --git a/src/multimedia/audio/qaudiooutput_mac_p.cpp b/src/multimedia/audio/qaudiooutput_mac_p.cpp index b457fed..9689101 100644 --- a/src/multimedia/audio/qaudiooutput_mac_p.cpp +++ b/src/multimedia/audio/qaudiooutput_mac_p.cpp @@ -536,6 +536,12 @@ int QAudioOutputPrivate::bufferSize() const void QAudioOutputPrivate::setNotifyInterval(int milliSeconds) { + if (intervalTimer->interval() == milliSeconds) + return; + + if (milliSeconds <= 0) + milliSeconds = 0; + intervalTimer->setInterval(milliSeconds); } @@ -622,7 +628,8 @@ void QAudioOutputPrivate::audioDeviceError() void QAudioOutputPrivate::startTimers() { audioBuffer->startFillTimer(); - intervalTimer->start(); + if (intervalTimer->interval() > 0) + intervalTimer->start(); } void QAudioOutputPrivate::stopTimers() |