diff options
author | Kurt Korbatits <kurt.korbatits@nokia.com> | 2009-11-09 04:26:02 (GMT) |
---|---|---|
committer | David Boddie <dboddie@trolltech.com> | 2009-11-11 16:06:46 (GMT) |
commit | 1cb5ebb48e88592cd8e685c998b92140d7dcabb4 (patch) | |
tree | fc9613bc00944023054bb1c1ab478872c982b0f7 /src | |
parent | 65da8e7e8810abf7d82e1d79722d3573e1b14ff0 (diff) | |
download | Qt-1cb5ebb48e88592cd8e685c998b92140d7dcabb4.zip Qt-1cb5ebb48e88592cd8e685c998b92140d7dcabb4.tar.gz Qt-1cb5ebb48e88592cd8e685c998b92140d7dcabb4.tar.bz2 |
Fixed runtime error in QAudioInput::bytesReady() function
If bytesReady() was called before start(), Div by Zero.
Added check for this condition.
Task-number:QTBUG-5300
Reviewed-by:Justin McPherson
Diffstat (limited to 'src')
-rw-r--r-- | src/multimedia/audio/qaudioinput_win32_p.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/multimedia/audio/qaudioinput_win32_p.cpp b/src/multimedia/audio/qaudioinput_win32_p.cpp index 31f6e25..b7f9ffd 100644 --- a/src/multimedia/audio/qaudioinput_win32_p.cpp +++ b/src/multimedia/audio/qaudioinput_win32_p.cpp @@ -333,6 +333,9 @@ void QAudioInputPrivate::close() int QAudioInputPrivate::bytesReady() const { + if(period_size == 0 || buffer_size == 0) + return 0; + int buf = ((buffer_size/period_size)-waveFreeBlockCount)*period_size; if(buf < 0) buf = 0; |