batocera-linux / batocera.linux

batocera.linux
https://batocera.org
Other
2.02k stars 515 forks source link

Massive "audio output device" setting issues when switching between Emulation Station and Kodi #4709

Closed Grandma-Betty closed 2 years ago

Grandma-Betty commented 3 years ago

Pre-information: Please note that I made the following issue description very detailed as I want to make sure everything within the attached logfiles is comprehensible. I think this all may contain some important information about the issue as the issue is reproducible anytime in my case. In addition, please note that this issue did not exist in Batocera V31 in my case (I tested it a few minutes ago to be sure).

Please have a look into the attached .zip file below on the Logs and data section. It contains the important support file generated by the Batocera system and enumerated screenshot pictures to prove everything I am writing down here.

Now let's start with the issue:

This issue belongs to Batocera V32 stable x86_64 version, a fresh and untouched installation from scratch onto a USB stick.

Hardware involved, all devices connected via HDMI: PC: Zotac CI323 nano (with latest BIOS version) AV-Receiver: NAD T187 TV: LG OLED55GX6 The whole speaker system is a 5.1 home cinema sound system.

Issue: After booting Batocera for the first time and then starting Kodi, the following Audio output device is set by default: Default ALSA Output (currently PipeWire Media Server)

1

In addition, when scrolling down, for the setting Passthrough output device the following is set by default: HDA Intel PCH, ALC892 Digital S/PDIF

2

With those settings the audio output is indeed working. So far, so good.

But: As you can see on the screenshot above, when using HDA Intel PCH, ALC892 Digital S/PDIF for Passthrough audio device, the only available audio formats for passthrough are Dolby Digital (AC3) and DTS, which is definitely not what I want when watching movies, because my AV-Receiver and the whole sound system can handle much more audio formats, e.g. TrueHD and DTS-HD. So the next step is to set Passthrough output device to the correct one, which is HDA Intel PCH, NAD NAD T187 on HDMI#2 in my case:

3

As you can see on the screenshot above, there are much more additional audio formats available now, e.g. E-AC3 and TrueHD and DTS-HD, which my AV-Receiver all can handle. With those settings the audio output is still indeed working. Still: So far, so good.

In addition I will show you all available Audio output device settings and all available Passthrough audio device settings (we will come to those later when these settings will be important according to the issue).

Audio output device settings available (Page 1 and Page 2): 4_1 4_2

Passthrough audio device settings available: 5

Now, when exiting from Kodi to Batocera, in Emulation Station System Settings, for AUDIO OUTPUT the following is set: AUTO And for AUDIO PROFILE, the following is set: AUTO

6

With those settings in the screenshot above, the audio output is not working. So obviously the next step is to navigate into AUDIO OUTPUT setting menu:

7

As you can see on the screenshot above, the only available devices here are the following by default (please note that compared to Kodi settings (screenshot 4_1.jpg and screenshot 4_2.jpg) there is not even a single(!) HDMI audio device available at this time):

Sidenote: In Batocera V31 I always had all the same three HDMI audio output devices (HDMI#1 and HDMI#2 and HDMI#3) available as within Kodi.

Going forward to AUDIO PROFILE settings, the following audio profiles are available by default, as you can see on the following screenshot:

8

Please note that compared to Kodi's available Audio output device settings (screenshot 4_1.jpg and screenshot 4_2.jpg) and Passthrough audio device settings (screenshot 5.jpg), there is no HDMI#0 or HDMI#1 or HDMI#2 device available within Emulation Station AUDIO PROFILE settings. Instead, for HDMI devices, it is only showing a single HDMI3 audio output device, which I'm not sure whether this is a normal behaviour in Batocera V32 or not (in Batocera V31 the HDMI devices did always correspondent, meaning: HDMI#0 in Kodi was also HDMI0 in Emulation station, HDMI#1 in Kodi was also HDMI1 in Emulation Station, and so on...).

Now to make audio output work, I will obviously choose the following AUDIO PROFILE setting: HDAINTEL PCH DIGITAL SURROUND 5.1 (HDMI3) OUTPUT After setting this and navigating back to AUDIO OUTPUT settings, the according audio output device BUILT-INAUDIO DIGITAL SURROUND 5.1 (HDMI3) is shows up and the previous device BUILT-INAUDIO ANALOG STEREO has disappeared completely, as you can see on the following screenshot:

9

Now the audio output is indeed working within Emulation Station. Still: So far, so good.

Now comes the real hassle:

When now starting Kodi again, within Kodi's Audio output device settings and within Passthrough audio device settings , the according setting HDA Intel PCH, NAD NAD T187 on HDMI#2, which I have set before (screenshot 3.jpg and screenshot 4_2.jpg and screenshot 5.jpg), has disappeared completely (!) and is not even selectable anymore, as you can see on the following screenshots.

Audio output device settings available (Page 1 and Page 2): 10_1 10_2

Passthrough audio device settings available: 11

For both, Audio output device settings and Passthrough audio device settings, as you can see on the screenshots above, the default settings have been restored and therefore, as the audio device HDA Intel PCH, NAD NAD T187 on HDMI#2 has disappeared completely, I am not able to passthrough TrueHD or DTS-HD or E-AC3 audio formats anymore. Only a system reboot brings back the HDA Intel PCH, NAD NAD T187 on HDMI#2 device which I then have to configure again from scratch, and then, when switching to Emulation Station and back to Kodi, the same hassle starts again.

Expected result: I would expect Kodi to keep the configured and saved HDMI#2 audio device settings when switching between Batocera and Kodi. It seems not possible because at some point the system loses the whole HDMI#2 device information.

Reproduction steps: I'm not sure whether this issue is reproducible with any HDMI based system but if it is, then the steps above can be repeated step-by-step sequentially in the same order I have wrote it down.

Logs and data: audioissue.zip

Conclusion: I hope everything is clear according to my issue description. If I can provide anything additional, please let me know. Again: The whole issue was not present in Batocera V31.

Grandma-Betty commented 3 years ago

FYI: I did a few edits right now as something went wrong with formating (thanks @"Atari" from Batocera Discord channel) and some minor informations were not clear. Everything should be clear now.

crcerror commented 3 years ago

Please give batocera-es-swissknife --kodi a chance. My guess is that ES does not release sounds driver because it uses PulseAudio. You need to SSH or terminal to enter the command.

Grandma-Betty commented 3 years ago

ok, I tried that now:

Booted Batocera into Kodi, set the correct HDMI#2 interface and exited from Kodi to Emulation Station. Then executed the following command... batocera-es-swissknife --kodi ...which after a few command line outputs made Kodi start. Then, when checking all available audio output devices, the result is still exactly the same: The according HDMI#2 device has disapperaed completely and is not selectable anymore.

So the issue remains exactly the same, unfortunately.

Grandma-Betty commented 3 years ago

Or was this command not supposed to change anything but just to give you more output details? If this is the case, here's the output which I have pasted into a file: Logfile.txt

Edit: Isn't it weird that Emulation Station has a single HDMI-3 device when Kodi has only HDMI#0 and HDMI#1 and HDMI#2 devices? Is that normal behaviour?

crcerror commented 3 years ago

Well this command should terminate EmulationStation and start KODI. But I doubt that this a normal behaviour. Some people would explain that it does the number of the HDMI source will not matter, but in your case some outputs are missing.

Batocera + PipeWire is really fine but it would better to remove libPA for ES and use PulseAudio only for flatpack. That would be a straight solution - currently it's ... well a hack. Even if I'm wrong and it has (I'm 100% sure) nothing to do with the issue from TO, even then issue solutions would be cleaner. But PipeWire itself should be considered in fact as a nice move.

Grandma-Betty commented 3 years ago

So I guess I have to wait until the next release to get this fixed? Can I provide anything additional to help?

Grandma-Betty commented 3 years ago

Any news on this issue?

nadenislamarre commented 3 years ago

"Expected result: I would expect Kodi to keep the configured and saved HDMI#2 audio device settings when switching between Batocera and Kodi."

in fact, es lives its life, and kodi lives its life. this is how it is designed. i don't understand the issue in fact. for me, it is working as expected.

Grandma-Betty commented 3 years ago

This is a joke, is it? There must be a dependency, otherwise it would not change settings when switching between each other. So it's impossible that each system is living its life independently. In Batocera 31 everything was fine.

Zoltan45 commented 3 years ago

brand new user here but having the exact same issue. My guess is when you set the audio device in ES it attempts to pass that device to Kodi *which it does, but kodi can no longer attach directly to the sound device to allow surround sound. :( hoping this is a one off. wondering if there is a workaround in settings. the only ting i tried was setting the audio device in batocera.conf which did not work.

Grandma-Betty commented 3 years ago

Glad I'm not the only one. As @crcerror already mentioned I guess ES is not releasing the sound drivers. My concern is that we cannot expect any support from here as it seems like normal behaviour to leave things as they are because of "not understanding the problem", to speak in quotation.

mhbates commented 2 years ago

Same issue here, and it took me far too long to find this, but I’m glad I did. Hopefully a fix comes soon. If not, is there an easy way to roll back to v31, and is the audio support worth doing that?

Grandma-Betty commented 2 years ago

Well it took me almost two hours of only issue documentation and I don't know what I could do more to make it as clear as possible. When devs say they don't understand the problem they either a) are not reading my issue documentaion b) don't care c) have limited knowledge about fixing this I'm not expecting this to be fixed soon, but hopefully I'm wrong. AFAIK it's not a big deal to roll back to version 31. Just backup your whole /userdata folder including all subfolders from your filesystem, make a fresh installation of V31 and then restore the /userdata folder including all subfolders. If it's worth or not going back to V31 honestly depends on your needs. V32 has potentially a lot of improvements but as you can see on this issue, some of them are bringing some new problems with them. Just check the changelogs where all new stuff between Batocera versions is listed.

Zoltan45 commented 2 years ago

everytime I think I have a video game/movie setup that i like, something like this pops up! For the meantime I am just going to disable kodi and dual boot libreelec and batocera. LE always seems to be the tried and true method to get a working kodi system.

xaholic commented 2 years ago

Same issue here, everytime i switch from Bato to Kodi I lose the settings and/or sound doesn't work as intended. In v31 it is ok.

Might be worth giving v33-beta a try as it seems it could fix some pipewire passthrough issues: https://github.com/batocera-linux/batocera.linux/issues/4958

Grandma-Betty commented 2 years ago

Might be worth giving v33-beta a try as it seems it could fix some pipewire passthrough issues: #4958

That did not change anything in my case. Still the same behaviour when switching from ES to Kodi.

xaholic commented 2 years ago

While tinkering with this I found a way to (somewhat) keep my audio settings from resetting between KODI and ES.

Start with default config:

While in ES menu:

However this is not a solution, and it causes other issues on my system so it would be helpful for dev to have a look at this problem.

Grandma-Betty commented 2 years ago

However this is not a solution, and it causes other issues on my system so it would be helpful for dev to have a look at this problem.

May I ask what other issues your "solution" brings up on your system?

xaholic commented 2 years ago

Going back to Bato from Kodi most times produces no sound. The settings are kept after a restart though. I advise going back to v31 if this issue is not looked at.

Grandma-Betty commented 2 years ago

The issues when switching between ES and Kodi still persist on today's released V33 beta batocera-x86_64-33-20211129.img.gz

Now, in addition, another audio issue came up: When exiting from Kodi to Batocera I have no sound in Batocera until I change Audio profile from "HDMI3" to "AUTO" and then back to "HDMI3".

He-Lord commented 2 years ago

I too have an issue related to this. Every time I boot to Batocera,I have to change my audio profile to auto and then back. Only then I am able to select the correct audio output. Built-inaudio digital stereo (HDMI) in my case.

Thanks @xaholic , editing batocera.conf keeps the setting after reboot.

Grandma-Betty commented 2 years ago

Bump! Any hope someone will have a look into this to fix it? The problem is still the same as documented in the initial issue report.

Grandma-Betty commented 2 years ago

While tinkering with this I found a way to (somewhat) keep my audio settings from resetting between KODI and ES.

Start with default config:

* Set default audio options in KODI then exit to ES.

* Set audio output and audio profile to auto then restart Batocera.

While in ES menu:

* Edit batocera.conf, add the following to the end of the file:
  `audio.profile=output:0,3`

* Start KODI and configure audio options then restart Batocera.

However this is not a solution, and it causes other issues on my system so it would be helpful for dev to have a look at this problem.

Unfortunately not working in my case. I have configured Kodi to start automatically after system boot. Then I exit to Batocera and when going back to Kodi, it won't start and hangs forever. Seems like it's not able to load the according drivers and waits forever. I can indeed login to the Baocera.linux command line and then restart the system manually so it's not completely crashing.

Grandma-Betty commented 2 years ago

Not 100% sure, but this could be related to this issue too: https://gitlab.com/recalbox/recalbox/-/issues/2163

Edit: Especially this part is interesting:

Passthrough Mode Used if you want to passthrough (bitstream) AC3, DTS, and EAC3 to an AVR or other device. In order to allow passthrough to work with PulseAudio then it MUST be set to use a 2.0 channel configuration, despite the 2.0 setting this will still allow 5.1 audio from AC3, DTS, and EAC3. Note: PulseAudio does not currently allow TrueHD or DTS-MA passthrough, this is a PulseAudio limitation and not a limitation of the Kodi implementation, in order to get 7.1 audio Multichannel Mode must be used.

Grandma-Betty commented 2 years ago

Well, the latest v34 beta (batocera-x86_64-34-20220306) seems to solve most of these issues. Switching from Kodi to ES and then back to Kodi keeps the audio settings in Kodi. Just because I'm curious: Were there any changes being made according to audio settings, compared to the previous v34 beta? Or was it just Kodi being updated from 19.2 to 19.3?

Only issue remaining now is when switching from Kodi to ES there is no audio in ES when using a HDMI audio profile. You can solve this as already mentioned before: Changing "Audio Profile" manually from "HDMI..." to "Auto" and then back to "HDMI...". But you have to do this every time you switch from Kodi to ES, which is annoying as you can imagine.

Grandma-Betty commented 2 years ago

Initial issue seems to be solved, but switching from Kodi to ES keeps breaking the audio output. Just opened a new ticket here: https://github.com/batocera-linux/batocera.linux/issues/5762