xbmc-imx6 / xbmc

XBMC Main Repository
http://xbmc.org
Other
32 stars 5 forks source link

Fix 24bit/4byte format when used in Linux #59

Closed warped-rudi closed 10 years ago

warped-rudi commented 10 years ago

As pointed out in #16, Linux ALSA/PulseAudio uses a different data representation than Windows when dealing with 24bit samples in 4 byte containers (AE_FMT_S24NE4, AE_FMT_S24BE4, AE_FMT_S24LE4) . This patch set introduces two distinct groups of formats. One that uses the upper 3 bytes (Windows) and on that uses the lower 3 bytes (Linux) to carry the audio data. The new formats are named AE_FMT_S24xE4H and AE_FMT_S24xE4L. The native formats ALSA:SND_PCM_FORMAT_S24 and PulseAudio:PA_SAMPLE_S24_32xE are now mapped to AE_FMT_S24NE4L.

wolfgar commented 10 years ago

Thank you very much Rudi ! I will give it a try this evening...

wolfgar commented 10 years ago

Tested with success : I have reverted the two 24bits workarounds (for analog and SPDIF) from the kernel. I have checked the noise issue was back and then applied your patch and got a proper behavior. That's all good to me all the more as your way to add a dedicated type to coexist friendly with the existing one seems fine Thanks for your contribution Rudi...

wolfgar commented 10 years ago

An update : If no specific remark is issued, I will merge this PR on monday...

CrawX commented 10 years ago

I tried to reproduce what Stephan said, but was unable to get the noise back in the first place. I have no clue why I can't seem to bring back the static with an unpatched kernel, but at least with this pr its also gone.

I really am puzzled why the static is gone even without this pr... I tried the exact same video that gave me static a few days ago...

Thanks.

wolfgar commented 10 years ago

@CrawX : As soon as you have properly reverted the 2 workarounds in the kernel, you should get the noise on analog output and on spdif (no passthrough), without this PR of course...

CrawX commented 10 years ago

@wolfgar thats what I thought. However using the standard wandboard-org/linux kernel (the 3.10.17 branch) I can't get the noise back. This is on HDMI, but I am 100% positive that I have had this issue. Thats why I fixed it in archlinuxarm/PKGBUILDs#789.

warped-rudi commented 10 years ago

I don't know what the 3.10.17 kernel does, but the kernels we are using on CuBox-i don't support 24bit samples on HDMI at all. Therefore, the issue fixed by this patch normally cannot be observed when audio is transmitted this way. However, it might be possible to configure ALSA/PulseAudio so that XBMC finds a 24bit capable audio device that maps to HDMI. In this case the problem would be present as well. Did you change something in your audio configuration recently ?

wolfgar commented 10 years ago

This PR solves issue with alsa devices which are able to deal with 24 bits Please check in your xbmc.log : if m_dataFormats associated with your ALSA device does not list AE_FMT_S24NE4* then the patch would do nothing (and it is totally normal...)