Behavior for selecting audio output device
#1
I currently use an external USB DAC connected to my RPi2 running Openelec. With the jump from XBMC v13 to Kodi v14, there has been a significant change in the way the audio output device is selected and such change is causing me issues.

With XMBC v13, I would simply set my audio output device to the DAC and when it came time to play a movie using omxplayer, XBMC would simply switch over to the next working audio output, which was HDMI (as omxplayer does not support ALSA, which the USB DAC requires). This was fine, as I could just run the HDMI to my TV, and the TV audio line-out to my amplifier. Then, if I simply wanted to listen to music, I could do so with the TV turned off, as the music would be output straight to my USB DAC.

Unfortunately, with Kodi v14, if I attempt to play a movie with the USB DAC selected, Kodi will now switch players from omxplayer to dvdplayer (I assume this is an intentional "feature"). While I'll definitely agree that the performance of dvdplayer has improved recently, it is still far, far inferior to the performance of omxplayer. On high bitrate movies, the audio pops randomly, frames are regularly dropped, and fast-forwarding/skipping is sluggish. This occurs on an overclocked RPi2 and even worse so on an RPi B.

I've posted about this before in the Openelec forums, but wasn't able to find a resolution. It was suggested to disable the "MMAL acceleration" option, but doing so only gets me a black screen when I attempt to play a movie with the USB DAC set as the audio output.


Thus, my question is: Is there any way to change the behavior of how Kodi handles playing back a movie with a USB DAC selected (i.e. an audio output device requiring ALSA) back to what it used to be in v13?

If this is not easily feasible, is there perhaps a way to instead force paplayer to use a different/specific audio output device than one used for video playback? Simply put, all I want to do is use the USB DAC for music and the HDMI audio output for video.
Reply
#2
If an ALSA audio device is selected:

By default audio uses paplayer which will use the configured (ALSA) audio device.
By default video uses dvdplayer (because omxplayer does not support the configured ALSA audio device.

If you disable MMAL acceleration, then video will not switch to dvdplayer, and should use omxplayer. That will default to HDMI, as ALSA is not supported.

So that should be the behaviour you desire. Can you reset all audio/video settings to default, enabled your USB ALSA audio device, and disable MMAL acceleration.
Test it. If there is an issue post a debug enabled log file showing you trying to play a file.
Reply
#3
Per your request, I reset all of the video/audio options to their defaults, changed the audio output to my ALSA USB DAC, and disabled MMAL acceleration. I enabled debug logging with extra AUDIO/VIDEO verbosity, and restarted the device. I then went ahead and attempted to play a known working movie and still got a black screen like I did before.

Please note that while the black screen is up, the logging text is still visible and if I hit the "video details" key, I can see that omxplayer is listed as running. I just don't get any audio/video.

The logs can be found here: http://www.mediafire.com/download/d4046m....14.40.zip
Reply
#4
If you don't enable your ALSA/USB device (so it's still on hdmi) does the same file play?
Reply
#5
Yes, the same file plays just fine with the audio output set to HDMI.

The "black screen" scenario only occurs when MMAL is disabled and the sound output is set to my ALSA/USB device.
Reply
#6
Based on what you've told me, it sounds like this behavior is a bug within Kodi. Should I simply proceed with creating a ticket in the Kodi bug tracker?
Reply
#7
(2015-03-17, 19:35)katzinator Wrote: Based on what you've told me, it sounds like this behavior is a bug within Kodi. Should I simply proceed with creating a ticket in the Kodi bug tracker?

Technically Kodi only supports a single audio output device, so it's not a Kodi bug.
It happened that at some point in the past there was a hack which gave the behaviour you desired, which doesn't seem to behave that way anymore.

I've had a quick look and I can reproduce the "black screen" effect you are seeing. Let me have a look, there may be a simple fix.
Reply
#8
Thank you for taking the time to look into this, I really appreciate it. Please let me know what you find and/or if you require any further testing on my end.
Reply
#9
I think this does what you want.
https://github.com/popcornmix/xbmc/commi...6f68ff51b0

It will appear in a subsequent Milhouse nightly build (maybe tonight, maybe tomorrow).
It it works okay I can add the change to helix branch to get it into a future stable build.
Reply
#10
It made it into tonight's build. Smile
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply
#11
Just tested Milhouse's build and everything works great (no more black screen and the switching between audio outputs is as expected)! Let's get this change into the official release branch!

Thank you, popcornmix for your patience and quick fix and thank you, Milhouse for getting this in the nightly so quickly.
Reply
#12
This is an old thread. Nevertheless the subject is still important. Today, I connected an USB DAC to my Raspi and it works for audio as expected but for the sound lacks behind. Any idea to fix it. Thank you.
Reply
#13
(2017-06-12, 14:05)tester14 Wrote: This is an old thread. Nevertheless the subject is still important. Today, I connected an USB DAC to my Raspi and it works for audio as expected but for the sound lacks behind. Any idea to fix it. Thank you.

By how much?
Can you adjust it with OSD audio settings (audio offset)?
If that fixes it you can choose "set as default for all videos"
Reply
#14
I discovered 2 issues:

1.) With Kodi (libreelec) 18.4 and a Raspi 2 with OMX Player acceleration switched on, MMAL off, and ALSA: USB Audio DAC selected  switching channels with a remote control (up and down button) does not work anymore. Direct selection of channels does work. And to get the TV sound again I have to switch between channels first.

2.) With Kodi (libreelec) 18.4 and a Raspi 4 it does not work at all. The MMAL option is gone.

Could somebody please have a look into this matter. Thank you.

Another option would be some kind of passthrough for audio player only. I would to listen to music and internet radio stations without the TV set switched on.
Reply

Logout Mark Read Team Forum Stats Members Help
Behavior for selecting audio output device0