diff options
author | Val Doroshchuk <valentyn.doroshchuk@qt.io> | 2018-01-02 17:27:33 +0100 |
---|---|---|
committer | VaL Doroshchuk <valentyn.doroshchuk@qt.io> | 2018-05-08 07:23:39 +0000 |
commit | 24664700b3162bb67ff2e28a1de2505fb76c3e0b (patch) | |
tree | 02505b075abbed7b1d5e3ac825c338b3124d29ef /src/plugins/windowsaudio | |
parent | 370c48039bfa0fe4325852358d603cf4438c3f47 (diff) | |
download | qtmultimedia-24664700b3162bb67ff2e28a1de2505fb76c3e0b.tar.gz |
DirectShow: Fix crackling when playing custom sample rate
Seems waveOutWrite() requires WAVEHDR->dwBufferLength to be even number
otherwise some crackling might be heard while playing.
And looks like it is not related to QAudioFormat, any of it produces the
issue.
Task-number: QTBUG-64931
Change-Id: I87dbe165611325d9c0291a3bffdc091397b42741
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Diffstat (limited to 'src/plugins/windowsaudio')
-rw-r--r-- | src/plugins/windowsaudio/qwindowsaudiooutput.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/plugins/windowsaudio/qwindowsaudiooutput.cpp b/src/plugins/windowsaudio/qwindowsaudiooutput.cpp index eb4caf128..d1c0b475f 100644 --- a/src/plugins/windowsaudio/qwindowsaudiooutput.cpp +++ b/src/plugins/windowsaudio/qwindowsaudiooutput.cpp @@ -241,6 +241,10 @@ bool QWindowsAudioOutput::open() period_size = buffer_size / 5; } + // Make even size of wave block to prevent crackling + // due to waveOutWrite() does not like odd buffer length + period_size &= ~1; + if (period_size == 0) { errorState = QAudio::OpenError; deviceState = QAudio::StoppedState; |