Skip to content

Commit b4bbab8

Browse files
authored
Convert to s6 style and remove Pulseaudio restart (#153)
* Convert overlay to new s6 style This fixes an issue where restarting Pulseaudio on new hardware didn't work. With this, we restart the pulseaudio service and wait for readiness. * Restart Pulseaudio on add and remove Restart Pulseaudio in both cases, when adding and removing devices. Also drop the unnecessary sleep. * Drop rescue streams as it is deprecated * Don't reload Pulseaudio The necessary modules get reloaded by Supervisor now.
1 parent da87a83 commit b4bbab8

File tree

10 files changed

+18
-19
lines changed

10 files changed

+18
-19
lines changed

rootfs/etc/pulse/system.pa

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ load-module module-native-protocol-unix auth-anonymous=1 auth-cookie-enabled=0 s
4040
### that look up the default sink/source get the right value
4141
load-module module-default-device-restore
4242

43-
### Automatically move streams to the default sink if the sink they are
44-
### connected to dies, similar for sources
45-
load-module module-rescue-streams
46-
4743
### Make sure we always have a sink around, even if it is a null sink.
4844
load-module module-always-sink
4945

rootfs/etc/services.d/alsa/run renamed to rootfs/etc/s6-overlay/s6-rc.d/alsa/run

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,15 @@ declare control
77
while read -r line; do
88

99
# Check if new ALSA mixer connecting
10-
if [[ ! "${line}" =~ add.*(controlC[0-9]) ]]; then
10+
if [[ "${line}" =~ add.*(controlC[0-9]) ]]; then
11+
control=${BASH_REMATCH[1]}
12+
bashio::log.info "Add ALSA mixer: ${control}"
13+
14+
# Run our soundconfig
15+
soundconfig "${control}"
16+
else
1117
bashio::log.debug "Skip ${line}"
1218
continue
13-
else
14-
control=${BASH_REMATCH[1]}
1519
fi
1620

17-
# Wait until new mixer is setup
18-
bashio::log.info "New ALSA mixer: ${control}"
19-
sleep 5
20-
21-
# Run our soundconfig
22-
soundconfig "${control}"
23-
24-
# Restart PulseAudio
25-
s6-svc -wD -d -T2500 "/var/run/s6/services/pulseaudio"
26-
s6-svc -wU -u -T2500 "/var/run/s6/services/pulseaudio"
27-
2821
done < <(udevadm monitor --subsystem-match=sound)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
longrun
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
# Check if pulseaudio socket exists
4+
test -S /data/external/pulse.sock
5+
exit
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3

rootfs/etc/services.d/pulseaudio/run renamed to rootfs/etc/s6-overlay/s6-rc.d/pulseaudio/run

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ fi
1717
export PULSE_STATE_PATH="/data/states"
1818
export LD_PRELOAD="/usr/local/lib/libjemalloc.so.2"
1919

20-
exec pulseaudio --system --disallow-exit --exit-idle-time=-1 --disable-shm "${pulse_args[@]}"
20+
exec s6-notifyoncheck -d -s 300 -w 300 -n 0 \
21+
pulseaudio --system --disallow-exit --exit-idle-time=-1 \
22+
--disable-shm "${pulse_args[@]}"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
longrun

rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/alsa

Whitespace-only changes.

rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/pulseaudio

Whitespace-only changes.

0 commit comments

Comments
 (0)