-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AUDIO] Implement support for WAVE_FORMAT_EXTENSIBLE audio format #6686
[AUDIO] Implement support for WAVE_FORMAT_EXTENSIBLE audio format #6686
Conversation
Reminder to myself: I will have to retest the following stuff with this PR: |
OK, thank you. Np. 👍 |
Fix opening audio device error when trying to open it with WAVE_FORMAT_EXTENSIBLE format tag set in wFormatTag member of WAVEFORMATEX: - Pass additional data size from WAVEFORMATEX.cbSize to pin data format. - Append it to the whole size of pin data format (KSDATAFORMAT.FormatSize). - Set additional fields in WAVEFORMATEXTENSIBLE structure (data format, BPS and channel mask) when WAVE_FORMAT_EXTENSIBLE is used. They are used by our inbuilt Intel AC97 miniport driver at least. It simply fails when these members are not set. - Fix pin connect allocation size by appending an additional data size from WAVEFORMATEX.cbSize to KSPIN_CONNECT + KSDATAFORMAT + WAVEFORMATEX. This allows to proerly initialize additional extensible data and avoids kernel memory leakage when using extensible audio format. - Remove format tag check which allowed WAVE_FORMAT_PCM to be opened correctly. So now all possible audio formats can be opened properly at least (although it does not mean they may work correctly). This fixes the audio playback for all apps those are supporting extensible audio data and use it by default (e. g. AIMP 5.30, QMMP 0.12.17, all Chrome/Chromium-based browsers, GameDev Tycoon Demo game etc.). CORE-10907, CORE-14783
…udio format is used - Append additional data size from WAVEFORMATEX.cbSize to pin connect size passed to KsCreatePin. If the tag is WAVE_FORMAT_PCM, then this member should always be zero. So in that case, no any additional data is passed to creation request, and the passed data size is correct for PCM too (KSDATAFORMAT + WAVEFORMATEX). This fixes audio playback in several apps those are supporting extensibble audio and use it by default (e. g. AIMP 5.30, QMMP 0.12.17, all Chrome/Chromium based browsers, GameDev Tycoon Demo game etc.). CORE-10907, CORE-14783.
…uest Store a correct size of additional data in WAVEFORMATEX.cbSize when performing open of audio device, when WAVE_FORMAT_EXTENSIBLE audio format is used. It allows to properly open audio device with Legacy APIs enabled too. This fixes audio playback in several apps those are using extensible audio data (e. g. AIMP 5.30, QMMP 0.12.17, all Chrome/Chromium based browsers, GameDevTycoon Demo game etc.). CORE-10907, CORE-14783
fac2d08
to
dc1feaf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My testing result of this PR's state
using the reactos-gcc-i386-Debug-0x502-b83bc3e1193965c4ef950b4004aee3fba0709402 GCC8.4.0dbg artifact (which is after the rebase and therefore implicitly contained also the PR6682:
CORE-10907 'AIMP DSOUND 16bit-cfg' is properly fixed.
see https://jira.reactos.org/browse/CORE-10907?focusedId=141749&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-141749 for details.
CORE-14783 'QMMP DSOUND vs. waveout' is properly fixed.
see https://jira.reactos.org/browse/CORE-14783?focusedId=141748&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-141748 for details.
The PR has no negative impact on the already earlier resolved https://jira.reactos.org/browse/CORE-16340 . Still plays sound and music fine. Still without any signs of heap-corruption.
The PR has absolutely no positive or negative impact on the yet unresolved https://jira.reactos.org/browse/CORE-17744 'FoxAudioPlayer with its WMM audio output'.
The PR has absolutely no positive or negative impact on the yet unresolved https://jira.reactos.org/browse/CORE-10118 'BRD demo app stops playing after 500ms'
The PR has absolutely no positive or negative impact on the already resolved https://jira.reactos.org/browse/CORE-15324
https://jira.reactos.org/browse/CORE-15693 can currently no longer be retested, because 'Hover' does not start anymore in master head 'Unable to allocate memory'. I can prove meanwhile, that this regression is not caused by Olegs PR, as it happens also on master head without his PR. I filed the fresh https://jira.reactos.org/browse/CORE-19505 for that now.
All in All: I could spot only improvements, but nothing breaking by this PR. I do think it is a very valuable contribution.
If nobody will add any negative review-comments to this PR, then I will merge it in t minus 1 week.
Thank you very much for your testing Joachim. 😊 |
PRs testbot result 0.4.15-dev-7884-gd72d61f vs. 0.4.15-dev-7885-g12b3272: {code} We were not skipping tests before the code changes, at least that's what the testbot says. |
Purpose
Fix opening audio device error when trying to open it with
WAVE_FORMAT_EXTENSIBLE
format tag set inwFormatTag
member ofWAVEFORMATEX
by the proper passing additional audio data size and removing aWAVE_FORMAT_PCM
limitation check, both for Legacy and MMixer APIs.This fixes audio playback in several apps those are using extensible audio data (e. g. AIMP 5.30 (needs to manually set BPS to 16 in settings still!), QMMP 0.12.17, all Chrome/Chromium based browsers, GameDevTycoon Demo game etc.).
Supersedes #3981.
Can be tested in pair with #6682 for better effect (is merged now).
JIRA issue: CORE-10907, CORE-14783, other audio issues might also be fixed, they need to be retested too and added here in case they are fixed!
Proposed changes
[MMIXER]
WAVEFORMATEX.cbSize
to pin data format.KSDATAFORMAT.FormatSize
).WAVEFORMATEXTENSIBLE
structure (data format, BPS and channel mask) when WAVE_FORMAT_EXTENSIBLE is used. They are used by our inbuilt Intel AC97 miniport driver at least. It simply fails when these members are not set.WAVEFORMATEX.cbSize
toKSPIN_CONNECT
+KSDATAFORMAT
+WAVEFORMATEX
. This allows to properly initialize additional extensible data and avoids kernel memory leakage when using extensible audio format.[KS]
WAVEFORMATEX.cbSize
to pin connect size passed toKsCreatePin
. If the tag isWAVE_FORMAT_PCM
, then this member should always be zero. So in that case, no any additional data is passed to creation request, and the passed data size is correct for PCM too (KSDATAFORMAT
+WAVEFORMATEX
).[WDMAUD.DRV]
WAVEFORMATEX.cbSize
when performing open of audio device, whenWAVE_FORMAT_EXTENSIBLE
audio format is used. It allows to properly open audio device with Legacy APIs enabled too.Result
As visible in the following video, all mentioned apps are now playing the sound correctly (can be played only in Chrome). 🙂
ros_extensible_format.mp4
GameDevTycoon Demo was not tested in the video, but @julenuri confirmed this app is now playing the sound properly too, as it did not do before my changes.