You are not logged in.
If I attempt to change the audio source from system>system>audio output while running xbmc as a normal user, I can select any option from the "Audio output device" section [HDMI,Analog,Digital]. If I run the xbmc-standalone service (xbmc.service) however, that particular option is grayed out. What am I missing? The xbmc user has all the needed group memberships since I am using the "standalone" method from the wiki.
% grep xbmc /etc/group
network:x:90:xbmc
video:x:91:xbmc
audio:x:92:mpd,facade,xbmc
optical:x:93:xbmc
xbmc:x:420:
Last edited by graysky (2014-08-28 09:14:08)
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
Here are the debug logs when started from the xbmc.service and from a regular user both having identical ~/.xbmc directories.
Full logs
Launched from xbmc user via the systemd service (contains the error I described): link.
Launched from a proper lxde session by another user, works as expected: link.
Condensed version showing the differences
Seems like the proper lxde session gets more audio options but why? link.
EDIT: I posted this to the official xbmc forums as well and a suggestion by one of the devs was that the systemd script does not wait long enough for the hdmi device to appear. if I modify the upstream provided /usr/bin/xbmc-standalone to have a 6s delay (I actually started at 1 sec and incremented up to 6 which seems to be the minimum required on my hardware), it works as intended, but there must be a more elegant solution...
% diff -uprN a/usr/bin/xbmc-standalone b/usr/bin/xbmc-standalone
--- a/usr/bin/xbmc-standalone 2014-08-10 14:36:15.506231766 -0400
+++ b/usr/bin/xbmc-standalone 2014-08-10 14:35:55.442898816 -0400
@@ -28,6 +28,7 @@ if [ -n "$PULSE_START" ]; then
# delay needed to allow PA to initialize for xbmc
# to detect all audio sources
$PULSE_START
+ sleep 6s
else
PULSE_SESSION="$(which pulse-session)"
if [ -n "$PULSE_SESSION" ]; then
Last edited by graysky (2014-08-28 10:03:30)
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
Just off the top of my head, what if you used BindsTo=?
Offline
@WW - One of the dev's in the xbmc thread I linked suggested that I wait for udevtrigger to finish but I am not sure how to do that. Also, not sure how to use a BindsTo line in the service file either.
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
The directives you can use for udev with systemd services are at 1070 line in man systemd.directives. Where is the service file located? I do not use xbmc myself, the package from repository seems not to contain any *.service files.
Is it this one or maybe this one?
Edit: Typos.
Last edited by emeres (2014-08-10 21:19:48)
Offline
@emeres - No, that is the socket, I am using the xbmc.service shown here which was shipped with the official Arch package until recently.
EDIT: Yes, I see your edited your post when I posted this
So how would we modify the xbmc.service to wait for the HDMI to get detected via those directives?
Last edited by graysky (2014-08-10 21:15:01)
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
Do I understand this correctly that the sound is not fully initialized before xbmc starts? If so, simply adding 'sound.target' to 'After' directive should work.
Edit: Added emphasis.
Last edited by emeres (2014-08-10 21:17:53)
Offline
Good suggestion, but appending 'sound.target' to the After directive did not work
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
Good suggestion, but appending 'sound.target' to the After directive did not work
Judging from xbmc-standalone script, xbmc uses pulseaudio. So you probably would have to find out the point in time where pulseaudio is ready with its initialization/grabbing of devices.
The service file calls xbmc-standalone, so it has no influence on state of pulseaudio, unless you would split the pulseaudio part to another service, but I doubt it would be worth the effort, although much more elegant.
Well, since I am a little bit rusty with PA, so I can only speculate to use something simple as 'pacmd | grep HDMI' as waiting condition. Pulseaudio should have some directory structure in /proc or somewhere else with information about its devices.
Offline
You are correct. Pulseaudio is to blame. I pushing just alsa, everything works as expected.
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
You are correct. Pulseaudio is to blame. I pushing just alsa, everything works as expected.
Come again? Is the issue solved or are you planning to continue to use pulseaudio with xbmc?
By the way, I would leave the sound.target in the service file. This should be also on the wiki, xbmc should not even attempt to start with sound not being fully initialized, although that might be more of a problem for older or unique hardware than most common desktops/laptops.
Offline
I would like to use PA, but need to figure out how to have the xbmc.service start after it is properly initialized. I opened a bugzilla with systemd and hopefully one of the experts can help.
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
Bellow is the relevant part of the xbmc-standalone script in question. Maybe it will encourage others to participate.
# http://www.gnu.org/copyleft/gpl.html
prefix="/usr"
exec_prefix="/usr"
bindir="${exec_prefix}/bin"
XBMC="${bindir}/xbmc --standalone $@"
PULSE_START="$(which start-pulseaudio-x11)"
if [ -n "$PULSE_START" ]; then
$PULSE_START
else
PULSE_SESSION="$(which pulse-session)"
if [ -n "$PULSE_SESSION" ]; then
XBMC="$PULSE_SESSION $XBMC"
fi
fi
LOOP=1
CRASHCOUNT=0
LASTSUCCESSFULSTART=$(date +%s)
while [ $(( $LOOP )) = "1" ]
do
$XBMC
RET=$?
NOW=$(date +%s)
if [ $(( ($RET >= 64 && $RET <=66) || $RET == 0 )) = "1" ]; then # clean exit
LOOP=0
[...]
How is pulseaudio getting started in your case graysky? Is the start-pulseaudio-x11 or pulse-session executed? Pacmd returns exit code 1, when pulseaudio is not running, maybe waiting for exit code 0 will be a sufficient replacement for the 6 s of sleep.
Edit: Typo.
Last edited by emeres (2014-08-11 10:02:11)
Offline
@emeres - On my system it is the it's PULSE_START, but pacmd always returns exit code 1 even with xbmc is running with my 6s delay and audio options are indeed available.
# su -c pacmd -s /bin/sh xbmc || echo $?
No PulseAudio daemon running, or not running as session daemon.
1
Yet:
% ps aux | grep pulse
xbmc 16102 0.0 0.2 359272 9468 ? S<l 14:46 0:00 /usr/bin/pulseaudio --start
xbmc 16105 0.0 0.0 76580 3180 ? S 14:46 0:00 /usr/lib/pulse/gconf-helper
Last edited by graysky (2014-08-11 18:50:13)
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
The start-pulseaudio-x11 is also a script. I think pacmd lacks at least one appropriate environment variable out of those listed at the end of 'man pulseaudio', but again I am no expert with pa. Maybe Rasi or V1del can provide more insight.
Offline
if I wait archlinux to start in cosole mode, login and then start XBMC systemd service audio doesn't work... why?
Offline
Just to update, it's been a few weeks:
The bugzilla task against systemd hasn't been assigned.
Several posts to the PA mailing list have not shown a clear solution.
Several posts to the xbmc forum have not shown a clear solution.
My conclusion at this point: if you wish to use PA + this xbmc.service, PA requires time to initialize. I have modified the AUR package that provides the service with this 6s startup delay which only applies to PA users (v1.3-1).
Last edited by graysky (2014-08-28 10:04:11)
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
ok now I have more options in "Audio Output" in fact if I chose a strange "HDA ATI, @@@" audio work also without enabling passtrough (that I have no idea of what it is).
what to say... I really hope that arch users, xbmc dev and pluseaudio dev will find a solution togheter.
Offline
@graysky So none of pa control tools helped? I would have thought, that listing available sinks or similar would be sufficient.
Offline
@fabio - dude, no one is working together on this.
@emeres - I haven't tried. The delay works, but isn't elegant in my view. Seems as though PA should report when it's initialized somehow if that it indeed the problem.
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline