jibri: switch to PulseAudio
Using PulseAudio means no longer needing to mount /dev/snd/ which should make deploying Jibri much easier. Credits: https://github.com/openfun/jibri-pulseaudio https://community.jitsi.org/t/tip-pulseaudio-support-for-jibri/65780 https://github.com/kpeiruza/jitsi-images
This commit is contained in:
@@ -21,22 +21,6 @@ fi
|
||||
[ -z "${DISPLAY}" ] \
|
||||
&& ( echo -e "\e[31mERROR: Please set DISPLAY variable.\e[39m"; kill 1; exit 1 )
|
||||
|
||||
# check loaded snd_aloop module and exit if is not loaded on the host
|
||||
[ -z "$(lsmod | grep -om1 snd_aloop)" ] \
|
||||
&& ( echo -e "\e[31mERROR: Please load snd-aloop module on the docker host.\e[39m"; kill 1; exit 1 )
|
||||
|
||||
# get host's audio group id
|
||||
host_audio_group="$(stat -c %g /dev/snd/pcmC0D0p 2>/dev/null)"
|
||||
|
||||
# audio group is not found. Has it been run without jibri.yml?
|
||||
[ -z "${host_audio_group}" ] \
|
||||
&& ( echo -e "\e[31mERROR: Binding /dev/snd is not found. Please check that you run docker-compose with -f jibri.yml.\e[39m"; kill 1; exit 1 )
|
||||
|
||||
# try to create group with this id. If group with the id already exists, just skip
|
||||
groupadd -g ${host_audio_group} jibri-audio >/dev/null 2>&1
|
||||
# include user to the group by id
|
||||
usermod -aG ${host_audio_group} jibri
|
||||
|
||||
# script for finalizing must have executing bit.
|
||||
[ ! -z "${JIBRI_FINALIZE_RECORDING_SCRIPT_PATH}" ] \
|
||||
&& [ -f "${JIBRI_FINALIZE_RECORDING_SCRIPT_PATH}" ] \
|
||||
@@ -57,6 +41,6 @@ mkdir -p ${JIBRI_RECORDING_DIR}
|
||||
chown -R jibri ${JIBRI_RECORDING_DIR}
|
||||
|
||||
# make logs dir
|
||||
[ -z "${JIBRI_LOGS_DIR}" ] && export JIBRI_LOGS_DIR=/config/logs
|
||||
JIBRI_LOGS_DIR=/config/logs
|
||||
mkdir -p ${JIBRI_LOGS_DIR}
|
||||
chown -R jibri ${JIBRI_LOGS_DIR}
|
||||
|
||||
2
jibri/rootfs/etc/fix-attrs.d/10-jibri
Normal file
2
jibri/rootfs/etc/fix-attrs.d/10-jibri
Normal file
@@ -0,0 +1,2 @@
|
||||
/home/jibri/.config true jibri 0640 0750
|
||||
/home/jibri false jibri 0640 0750
|
||||
69
jibri/rootfs/etc/pulse/default.pa
Normal file
69
jibri/rootfs/etc/pulse/default.pa
Normal file
@@ -0,0 +1,69 @@
|
||||
#!/usr/bin/pulseaudio -nF
|
||||
#
|
||||
# This file is part of PulseAudio.
|
||||
#
|
||||
# PulseAudio is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# PulseAudio is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# This startup script is used only if PulseAudio is started per-user
|
||||
# (i.e. not in system mode)
|
||||
|
||||
# Customized for Jibri
|
||||
|
||||
.fail
|
||||
|
||||
### Automatically restore the volume of streams and devices
|
||||
load-module module-device-restore
|
||||
load-module module-stream-restore
|
||||
load-module module-card-restore
|
||||
|
||||
### Automatically augment property information from .desktop files
|
||||
### stored in /usr/share/application
|
||||
load-module module-augment-properties
|
||||
|
||||
### Should be after module-*-restore but before module-*-detect
|
||||
load-module module-switch-on-port-available
|
||||
|
||||
### Load several protocols
|
||||
load-module module-native-protocol-unix
|
||||
|
||||
### Automatically restore the default sink/source when changed by the user
|
||||
### during runtime
|
||||
### NOTE: This should be loaded as early as possible so that subsequent modules
|
||||
### that look up the default sink/source get the right value
|
||||
load-module module-default-device-restore
|
||||
|
||||
### Automatically move streams to the default sink if the sink they are
|
||||
### connected to dies, similar for sources
|
||||
load-module module-rescue-streams
|
||||
|
||||
### Make sure we always have a sink around, even if it is a null sink.
|
||||
load-module module-always-sink
|
||||
|
||||
### Honour intended role device property
|
||||
load-module module-intended-roles
|
||||
|
||||
### Automatically suspend sinks/sources that become idle for too long
|
||||
load-module module-suspend-on-idle
|
||||
|
||||
### If autoexit on idle is enabled we want to make sure we only quit
|
||||
### when no local session needs us anymore.
|
||||
#.ifexists module-console-kit.so
|
||||
#load-module module-console-kit
|
||||
#.endif
|
||||
#.ifexists module-systemd-login.so
|
||||
#load-module module-systemd-login
|
||||
#.endif
|
||||
|
||||
### Enable positioned event sounds
|
||||
load-module module-position-event-sounds
|
||||
4
jibri/rootfs/etc/services.d/30-pulse/run
Normal file
4
jibri/rootfs/etc/services.d/30-pulse/run
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
HOME=/home/jibri
|
||||
exec s6-setuidgid jibri /bin/bash -c "exec /usr/bin/pulseaudio"
|
||||
Reference in New Issue
Block a user