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:
@@ -9,15 +9,10 @@ services:
|
|||||||
- /dev/shm:/dev/shm
|
- /dev/shm:/dev/shm
|
||||||
cap_add:
|
cap_add:
|
||||||
- SYS_ADMIN
|
- SYS_ADMIN
|
||||||
- NET_BIND_SERVICE
|
|
||||||
devices:
|
|
||||||
- /dev/snd:/dev/snd
|
|
||||||
environment:
|
environment:
|
||||||
- CHROMIUM_FLAGS
|
- CHROMIUM_FLAGS
|
||||||
- DISPLAY=:0
|
- DISPLAY=:0
|
||||||
- ENABLE_STATS_D
|
- ENABLE_STATS_D
|
||||||
- JIBRI_FFMPEG_AUDIO_SOURCE
|
|
||||||
- JIBRI_FFMPEG_AUDIO_DEVICE
|
|
||||||
- JIBRI_HTTP_API_EXTERNAL_PORT
|
- JIBRI_HTTP_API_EXTERNAL_PORT
|
||||||
- JIBRI_HTTP_API_INTERNAL_PORT
|
- JIBRI_HTTP_API_INTERNAL_PORT
|
||||||
- JIBRI_RECORDING_RESOLUTION
|
- JIBRI_RECORDING_RESOLUTION
|
||||||
@@ -30,7 +25,6 @@ services:
|
|||||||
- JIBRI_RECORDING_DIR
|
- JIBRI_RECORDING_DIR
|
||||||
- JIBRI_FINALIZE_RECORDING_SCRIPT_PATH
|
- JIBRI_FINALIZE_RECORDING_SCRIPT_PATH
|
||||||
- JIBRI_STRIP_DOMAIN_JID
|
- JIBRI_STRIP_DOMAIN_JID
|
||||||
- JIBRI_LOGS_DIR
|
|
||||||
- PUBLIC_URL
|
- PUBLIC_URL
|
||||||
- TZ
|
- TZ
|
||||||
- XMPP_AUTH_DOMAIN
|
- XMPP_AUTH_DOMAIN
|
||||||
@@ -45,4 +39,3 @@ services:
|
|||||||
- jicofo
|
- jicofo
|
||||||
networks:
|
networks:
|
||||||
meet.jitsi:
|
meet.jitsi:
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,9 @@ ARG CHROMEDRIVER_MAJOR_RELEASE=102
|
|||||||
COPY rootfs/ /
|
COPY rootfs/ /
|
||||||
|
|
||||||
RUN apt-dpkg-wrap apt-get update && \
|
RUN apt-dpkg-wrap apt-get update && \
|
||||||
apt-dpkg-wrap apt-get install -y jibri libgl1-mesa-dri procps jitsi-upload-integrations jq && \
|
apt-dpkg-wrap apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" jibri libgl1-mesa-dri procps jitsi-upload-integrations jq pulseaudio dbus dbus-x11 rtkit && \
|
||||||
/usr/bin/install-chrome.sh && \
|
/usr/bin/install-chrome.sh && \
|
||||||
apt-cleanup
|
apt-cleanup && \
|
||||||
|
adduser jibri rtkit
|
||||||
|
|
||||||
VOLUME /config
|
VOLUME /config
|
||||||
|
|||||||
@@ -103,14 +103,10 @@ jibri {
|
|||||||
|
|
||||||
ffmpeg {
|
ffmpeg {
|
||||||
resolution = "{{ $JIBRI_RECORDING_RESOLUTION }}"
|
resolution = "{{ $JIBRI_RECORDING_RESOLUTION }}"
|
||||||
{{ if .Env.JIBRI_FFMPEG_AUDIO_SOURCE -}}
|
|
||||||
// The audio source that will be used to capture audio on Linux
|
// The audio source that will be used to capture audio on Linux
|
||||||
audio-source = "{{ .Env.JIBRI_FFMPEG_AUDIO_SOURCE }}"
|
audio-source = "pulse"
|
||||||
{{ end -}}
|
|
||||||
{{ if .Env.JIBRI_FFMPEG_AUDIO_DEVICE -}}
|
|
||||||
// The audio device that will be used to capture audio on Linux
|
// The audio device that will be used to capture audio on Linux
|
||||||
audio-device = "{{ .Env.JIBRI_FFMPEG_AUDIO_DEVICE }}"
|
audio-device = "default"
|
||||||
{{ end -}}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{{ if .Env.CHROMIUM_FLAGS -}}
|
{{ if .Env.CHROMIUM_FLAGS -}}
|
||||||
|
|||||||
@@ -1,29 +1,27 @@
|
|||||||
{{ $JIBRI_LOGS_DIR := .Env.JIBRI_LOGS_DIR | default "/config/logs" -}}
|
|
||||||
|
|
||||||
handlers = java.util.logging.FileHandler, java.util.logging.ConsoleHandler
|
handlers = java.util.logging.FileHandler, java.util.logging.ConsoleHandler
|
||||||
|
|
||||||
org.jitsi.utils.logging2.JitsiLogFormatter.programname=Jibri
|
org.jitsi.utils.logging2.JitsiLogFormatter.programname=Jibri
|
||||||
|
|
||||||
java.util.logging.FileHandler.level = FINE
|
java.util.logging.FileHandler.level = FINE
|
||||||
java.util.logging.FileHandler.pattern = {{ $JIBRI_LOGS_DIR }}/log.%g.txt
|
java.util.logging.FileHandler.pattern = /config/logs/log.%g.txt
|
||||||
java.util.logging.FileHandler.formatter = org.jitsi.utils.logging2.JitsiLogFormatter
|
java.util.logging.FileHandler.formatter = org.jitsi.utils.logging2.JitsiLogFormatter
|
||||||
java.util.logging.FileHandler.count = 10
|
java.util.logging.FileHandler.count = 10
|
||||||
java.util.logging.FileHandler.limit = 10000000
|
java.util.logging.FileHandler.limit = 10000000
|
||||||
|
|
||||||
org.jitsi.jibri.capture.ffmpeg.util.FfmpegFileHandler.level = FINE
|
org.jitsi.jibri.capture.ffmpeg.util.FfmpegFileHandler.level = FINE
|
||||||
org.jitsi.jibri.capture.ffmpeg.util.FfmpegFileHandler.pattern = {{ $JIBRI_LOGS_DIR }}/ffmpeg.%g.txt
|
org.jitsi.jibri.capture.ffmpeg.util.FfmpegFileHandler.pattern = /config/logs/ffmpeg.%g.txt
|
||||||
org.jitsi.jibri.capture.ffmpeg.util.FfmpegFileHandler.formatter = org.jitsi.utils.logging2.JitsiLogFormatter
|
org.jitsi.jibri.capture.ffmpeg.util.FfmpegFileHandler.formatter = org.jitsi.utils.logging2.JitsiLogFormatter
|
||||||
org.jitsi.jibri.capture.ffmpeg.util.FfmpegFileHandler.count = 10
|
org.jitsi.jibri.capture.ffmpeg.util.FfmpegFileHandler.count = 10
|
||||||
org.jitsi.jibri.capture.ffmpeg.util.FfmpegFileHandler.limit = 10000000
|
org.jitsi.jibri.capture.ffmpeg.util.FfmpegFileHandler.limit = 10000000
|
||||||
|
|
||||||
org.jitsi.jibri.sipgateway.pjsua.util.PjsuaFileHandler.level = FINE
|
org.jitsi.jibri.sipgateway.pjsua.util.PjsuaFileHandler.level = FINE
|
||||||
org.jitsi.jibri.sipgateway.pjsua.util.PjsuaFileHandler.pattern = {{ $JIBRI_LOGS_DIR }}/pjsua.%g.txt
|
org.jitsi.jibri.sipgateway.pjsua.util.PjsuaFileHandler.pattern = /config/logs/pjsua.%g.txt
|
||||||
org.jitsi.jibri.sipgateway.pjsua.util.PjsuaFileHandler.formatter = org.jitsi.utils.logging2.JitsiLogFormatter
|
org.jitsi.jibri.sipgateway.pjsua.util.PjsuaFileHandler.formatter = org.jitsi.utils.logging2.JitsiLogFormatter
|
||||||
org.jitsi.jibri.sipgateway.pjsua.util.PjsuaFileHandler.count = 10
|
org.jitsi.jibri.sipgateway.pjsua.util.PjsuaFileHandler.count = 10
|
||||||
org.jitsi.jibri.sipgateway.pjsua.util.PjsuaFileHandler.limit = 10000000
|
org.jitsi.jibri.sipgateway.pjsua.util.PjsuaFileHandler.limit = 10000000
|
||||||
|
|
||||||
org.jitsi.jibri.selenium.util.BrowserFileHandler.level = FINE
|
org.jitsi.jibri.selenium.util.BrowserFileHandler.level = FINE
|
||||||
org.jitsi.jibri.selenium.util.BrowserFileHandler.pattern = {{ $JIBRI_LOGS_DIR }}/browser.%g.txt
|
org.jitsi.jibri.selenium.util.BrowserFileHandler.pattern = /config/logs/browser.%g.txt
|
||||||
org.jitsi.jibri.selenium.util.BrowserFileHandler.formatter = org.jitsi.utils.logging2.JitsiLogFormatter
|
org.jitsi.jibri.selenium.util.BrowserFileHandler.formatter = org.jitsi.utils.logging2.JitsiLogFormatter
|
||||||
org.jitsi.jibri.selenium.util.BrowserFileHandler.count = 10
|
org.jitsi.jibri.selenium.util.BrowserFileHandler.count = 10
|
||||||
org.jitsi.jibri.selenium.util.BrowserFileHandler.limit = 10000000
|
org.jitsi.jibri.selenium.util.BrowserFileHandler.limit = 10000000
|
||||||
|
|||||||
@@ -21,22 +21,6 @@ fi
|
|||||||
[ -z "${DISPLAY}" ] \
|
[ -z "${DISPLAY}" ] \
|
||||||
&& ( echo -e "\e[31mERROR: Please set DISPLAY variable.\e[39m"; kill 1; exit 1 )
|
&& ( 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.
|
# script for finalizing must have executing bit.
|
||||||
[ ! -z "${JIBRI_FINALIZE_RECORDING_SCRIPT_PATH}" ] \
|
[ ! -z "${JIBRI_FINALIZE_RECORDING_SCRIPT_PATH}" ] \
|
||||||
&& [ -f "${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}
|
chown -R jibri ${JIBRI_RECORDING_DIR}
|
||||||
|
|
||||||
# make logs dir
|
# make logs dir
|
||||||
[ -z "${JIBRI_LOGS_DIR}" ] && export JIBRI_LOGS_DIR=/config/logs
|
JIBRI_LOGS_DIR=/config/logs
|
||||||
mkdir -p ${JIBRI_LOGS_DIR}
|
mkdir -p ${JIBRI_LOGS_DIR}
|
||||||
chown -R jibri ${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"
|
||||||
1
jibri/rootfs/home/jibri/.config/pulse/client.conf
Normal file
1
jibri/rootfs/home/jibri/.config/pulse/client.conf
Normal file
@@ -0,0 +1 @@
|
|||||||
|
autospawn = no
|
||||||
9
jibri/rootfs/home/jibri/.config/pulse/daemon.conf
Normal file
9
jibri/rootfs/home/jibri/.config/pulse/daemon.conf
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
daemonize = no
|
||||||
|
high-priority = no
|
||||||
|
realtime-scheduling = yes
|
||||||
|
realtime-priority = 5
|
||||||
|
exit-idle-time = -1
|
||||||
|
flat-volumes = no
|
||||||
|
deferred-volume-safety-margin-usec = 1
|
||||||
|
log-level = info
|
||||||
|
log-target = file:/config/logs/pulse.log
|
||||||
8
jibri/rootfs/home/jibri/.config/pulse/default.pa
Normal file
8
jibri/rootfs/home/jibri/.config/pulse/default.pa
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
.include /etc/pulse/default.pa
|
||||||
|
|
||||||
|
# Load the virtual sink and set it as default
|
||||||
|
load-module module-virtual-sink sink_name=jibri-loop
|
||||||
|
set-default-sink jibri-loop
|
||||||
|
|
||||||
|
# set the monitor of the jibri-loop sink to be the default source
|
||||||
|
set-default-source jibri-loop.monitor
|
||||||
Reference in New Issue
Block a user