Skip to content
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

[Xbox] WASAPI: improves/fix 48000 Hz sample rate detection #21155

Merged
merged 1 commit into from
Mar 21, 2022

Conversation

thexai
Copy link
Member

@thexai thexai commented Mar 20, 2022

Description

WASAPI: improves/fix 48000 Hz sample rate detection.

Fixes DTS passthrough switch is not displayed in Xbox audio settings (still DTS works).

Motivation and context

Samples rates detection is based on KSDATAFORMAT_SUBTYPE_PCM test. Since WASAPI on Xbox only supports passthrough, PCM test fails but 48000 is implicit supported if KSDATAFORMAT_SUBTYPE_IEC61937_DTS or KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_DIGITAL are supported.

The error was hidden because apart from the DTS switch not being displayed in GUI, the DTS audio PT was still working.

Although it has never been reported before (far as I know), the same could happen in Windows x64 if a device does not support 16 bit / PCM / 48 KHz specifically but instead supports the RAW format corresponding to DTS or AC3.
It seems strange but an HDMI device could only support 32/24 bits in PCM and fail because only 16 bits are tested.

How has this been tested?

Runtime tested Xbox Series S.

Tested that DTS PT works same as before but also tested with DTS switch disabled and DTS is played as multichannel PCM.
Previously it was not possible to specifically disable the DTS format.

What is the effect on users?

[Xbox] fixes DTS passthrough switch is not displayed in GUI audio settings.
[Xbox] fixes DTS passthrough format cannot be disabled.
[Xbox] probably on systems that only supports 48KHz and not 192KHz (ARC ?), fixes passthrough didn't work at all. (not tested)

Screenshots (if appropriate):

Before (no DTS switch)
screenshot00000 (2)

After
screenshot00000

Types of change

  • Bug fix (non-breaking change which fixes an issue)
  • Clean up (non-breaking change which removes non-working, unmaintained functionality)
  • Improvement (non-breaking change which improves existing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that will cause existing functionality to change)
  • Cosmetic change (non-breaking change that doesn't touch code)
  • None of the above (please explain below)

Checklist:

  • My code follows the Code Guidelines of this project
  • My change requires a change to the documentation, either Doxygen or wiki
  • I have updated the documentation accordingly
  • I have read the Contributing document
  • I have added tests to cover my change
  • All new and existing tests passed

NOTES:
Samples rates detection is based on KSDATAFORMAT_SUBTYPE_PCM test.
Since WASAPI on Xbox only supports passthrough, PCM test fails but
48000 is implicit supported if KSDATAFORMAT_SUBTYPE_IEC61937_DTS
or KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_DIGITAL are supported.
@thexai
Copy link
Member Author

thexai commented Mar 20, 2022

Users forum logs confirms same behavior on Xbox One:

https://paste.kodi.tv/avuhukuhoj

general>: Enumerated WASAPI devices:
<general>:     Device 1
<general>:         m_deviceName      : \\?\SWD#MMDEVAPI#{0.0.0.00000000}.{feba3eaa-8b20-4914-ab94-9545df53ed98}#{e6327cad-dcec-4949-ae8a-991e976a79d2}
<general>:         m_displayName     : HDMI - Digital Output (Virtual Audio Device)
<general>:         m_displayNameExtra: WASAPI: Digital Output (Virtual Audio Device)
<general>:         m_deviceType      : AE_DEVTYPE_HDMI
<general>:         m_channels        : FL, FR, FC, LFE, BL, BR, SL, SR
<general>:         m_sampleRates     : 192000
<general>:         m_dataFormats     : AE_FMT_S24NE4MSB,AE_FMT_RAW
<general>:         m_streamTypes     : STREAM_TYPE_DTSHD,STREAM_TYPE_DTSHD_MA,STREAM_TYPE_TRUEHD,STREAM_TYPE_EAC3,STREAM_TYPE_DTSHD_CORE,STREAM_TYPE_DTS_2048,STREAM_TYPE_DTS_1024,STREAM_TYPE_DTS_512,STREAM_TYPE_AC3
<general>:     Device 2
<general>:         m_deviceName      : default
<general>:         m_displayName     : default
<general>:         m_displayNameExtra: 
<general>:         m_deviceType      : AE_DEVTYPE_HDMI
<general>:         m_channels        : FL, FR, FC, LFE, BL, BR, SL, SR
<general>:         m_sampleRates     : 192000
<general>:         m_dataFormats     : AE_FMT_S24NE4MSB,AE_FMT_RAW
<general>:         m_streamTypes     : STREAM_TYPE_DTSHD,STREAM_TYPE_DTSHD_MA,STREAM_TYPE_TRUEHD,STREAM_TYPE_EAC3,STREAM_TYPE_DTSHD_CORE,STREAM_TYPE_DTS_2048,STREAM_TYPE_DTS_1024,STREAM_TYPE_DTS_512,STREAM_TYPE_AC3

Only 192000 sample rate detected

@thexai thexai merged commit da7f339 into xbmc:master Mar 21, 2022
@thexai thexai deleted the xbox-fix-48000 branch March 21, 2022 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants