-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
AESinkALSA: only use S24NE4MSB with S32 alsa format #13701
Conversation
@@ -746,9 +746,13 @@ bool CAESinkALSA::InitializeHW(const ALSAConfig &inconfig, ALSAConfig &outconfig | |||
int bits = snd_pcm_hw_params_get_sbits(hw_params); | |||
if (bits != fmtBits) | |||
{ | |||
/* if we opened in 32bit and only have 24bits, signal it accordingly */ | |||
/* |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
if (fmtBits == 32 && bits == 24) | ||
i = AE_FMT_S24NE4MSB; | ||
i = (fmt == SND_PCM_FORMAT_S32) ? AE_FMT_S24NE4MSB : AE_FMT_S24NE4; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@FernetMenta updated to use if block like you suggested, also removed the comment change since the code now is much easier to follow |
There could still be an issue with S16 formats, noticed I got the following when I removed both S24 and S32 in kernel driver. S16 reported 0 significant bits.
It then continues and falls back on "default" alsa device. |
@@ -747,8 +747,10 @@ bool CAESinkALSA::InitializeHW(const ALSAConfig &inconfig, ALSAConfig &outconfig | |||
if (bits != fmtBits) | |||
{ | |||
/* if we opened in 32bit and only have 24bits, signal it accordingly */ | |||
if (fmtBits == 32 && bits == 24) | |||
if (fmt == SND_PCM_FORMAT_S32 && fmtBits == 32 && bits == 24) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Updated to remove |
Added two new commits that fixes two related issues:
S16 will be selected instead of falling back to "default" alsa device
|
@@ -752,7 +756,10 @@ bool CAESinkALSA::InitializeHW(const ALSAConfig &inconfig, ALSAConfig &outconfig | |||
else if (fmt == SND_PCM_FORMAT_S24 && bits == 24) | |||
i = AE_FMT_S24NE4; | |||
else | |||
{ | |||
snd_pcm_hw_params_copy(hw_params, hw_params_copy); // restore hw_params |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -748,7 +748,7 @@ bool CAESinkALSA::InitializeHW(const ALSAConfig &inconfig, ALSAConfig &outconfig | |||
|
|||
int fmtBits = CAEUtil::DataFormatToBits(i); | |||
int bits = snd_pcm_hw_params_get_sbits(hw_params); | |||
if (bits != fmtBits) | |||
if (bits && bits != fmtBits) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
updated to simplify code flow, now always restore hw_params before testing next alsa format and a short comment was added to indicate that bits check is skipped when bogus sbits is returned (not yet fully runtime tested) |
jenkins build this please |
Thanks |
likewise |
Description
This PR fixes incorrect signaling of
AE_FMT_S24NE4MSB
format together withSND_PCM_FORMAT_S24
alsa format. (fixes white noise on Rockchip and HDMI alsa device)Motivation and Context
Kodi incorrectly signals the
AE_FMT_S24NE4MSB
format using an alsa device limited to 24 significant bits whenSND_PCM_FORMAT_S24
is probed beforeSND_PCM_FORMAT_S32
.Fix this by only signaling
AE_FMT_S24NE4MSB
when probingSND_PCM_FORMAT_S32
.This issue can be observed on Rockchip platform when using the HDMI alsa device (hdmi-codec and dw-hdmi-i2s), current workaround have been to remove the signaling of 24 significant bits in kernel (Kwiboo/linux-rockchip@1f19793)
How Has This Been Tested?
Before: AE_FMT_S24NE4MSB is wrongly used for S24
After: AE_FMT_S24NE4 is used for S24
After: AE_FMT_S24NE4MSB is used for S32 and 24 significant bits (S24 support is removed in kernel driver)
After: AE_FMT_S32NE is used for S32 with 32 significant bits (S24 support is removed in kernel driver)
Screenshots (if appropriate):
Types of change
Checklist: