From 20ab0e8d3e852a4e6f571203191b39abca642785 Mon Sep 17 00:00:00 2001 From: David Trattnig <david.trattnig@o94.at> Date: Wed, 16 Jun 2021 21:34:52 +0200 Subject: [PATCH] More testing. #1 --- run.sh | 2 +- ...g.sh => test_lqs2_alsa_live_unbuffered.sh} | 6 ++- ...sa_default_file.liq => test_alsa_file.liq} | 4 +- ...fault_live.liq => test_alsa_framesize.liq} | 10 ++--- tests/test_alsa_live_buffered.liq | 35 ++++++++++++++++++ tests/test_alsa_live_double_buffered.liq | 37 +++++++++++++++++++ ...size.liq => test_alsa_live_unbuffered.liq} | 13 ++++++- 7 files changed, 95 insertions(+), 12 deletions(-) rename tests/docker/{test_docker_analog.sh => test_lqs2_alsa_live_unbuffered.sh} (72%) rename tests/{test_alsa_default_file.liq => test_alsa_file.liq} (92%) rename tests/{test_alsa_default_live.liq => test_alsa_framesize.liq} (74%) mode change 100644 => 100755 create mode 100644 tests/test_alsa_live_buffered.liq create mode 100644 tests/test_alsa_live_double_buffered.liq rename tests/{test_framesize.liq => test_alsa_live_unbuffered.liq} (66%) mode change 100755 => 100644 diff --git a/run.sh b/run.sh index 78364d2..a0455b8 100755 --- a/run.sh +++ b/run.sh @@ -99,7 +99,7 @@ if [[ $docker == "true" ]]; then -v "$AUDIO_DIR/playlist":"/var/audio/playlist":ro \ -v "$AUDIO_DIR/station":"/var/audio/station":ro \ -v "$BASE_DIR/contrib":"/srv/contrib" \ - -v "$BASE_DIR/tests":"/srv/tests" \ + -v "$BASE_DIR/tests":"/srv/tests" \ -v "$BASE_DIR/logs":"/srv/logs" \ -v "/etc/asound.conf":"/etc/asound.conf" \ --mount type=tmpfs,destination=/tmp \ diff --git a/tests/docker/test_docker_analog.sh b/tests/docker/test_lqs2_alsa_live_unbuffered.sh similarity index 72% rename from tests/docker/test_docker_analog.sh rename to tests/docker/test_lqs2_alsa_live_unbuffered.sh index c860cac..a24e796 100644 --- a/tests/docker/test_docker_analog.sh +++ b/tests/docker/test_lqs2_alsa_live_unbuffered.sh @@ -19,4 +19,8 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. -docker run -it -v /dev/snd:/dev/snd -v "/etc/asound.conf":"/etc/asound.conf" --privileged savonet/liquidsoap:main liquidsoap 'set("log.level",5)' 'set("frame.audio.size", 15052)' 'set("frame.video.framerate", 0)' 'output.alsa(bufferize=false, input.alsa(bufferize=false))' \ No newline at end of file +docker run -it \ + -v /dev/snd:/dev/snd \ + -v "/etc/asound.conf":"/etc/asound.conf" \ + --privileged savonet/liquidsoap:main \ + liquidsoap 'set("log.level",5)' 'set("frame.audio.size", 15052)' 'set("frame.video.framerate", 0)' 'output.alsa(bufferize=false, input.alsa(bufferize=false))' \ No newline at end of file diff --git a/tests/test_alsa_default_file.liq b/tests/test_alsa_file.liq similarity index 92% rename from tests/test_alsa_default_file.liq rename to tests/test_alsa_file.liq index d9f7067..93f1e8f 100644 --- a/tests/test_alsa_default_file.liq +++ b/tests/test_alsa_file.liq @@ -1,8 +1,8 @@ -#!/usr/bin/liquidsoap --verbose +#!/usr/bin/env liquidsoap # # Aura Engine (https://gitlab.servus.at/aura/engine) # -# Copyright (C) 2017-2020 - The Aura Engine Team. +# Copyright (C) 2017-now() - The Aura Engine Team. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by diff --git a/tests/test_alsa_default_live.liq b/tests/test_alsa_framesize.liq old mode 100644 new mode 100755 similarity index 74% rename from tests/test_alsa_default_live.liq rename to tests/test_alsa_framesize.liq index 5c16083..5e74c01 --- a/tests/test_alsa_default_live.liq +++ b/tests/test_alsa_framesize.liq @@ -19,13 +19,11 @@ set("init.allow_root", true) -set("init.catch_exn", false) set("log.file.path", "../logs/<script>.log") -set("log.level", 5) -set("ffmpeg.log.level", 5) +# Set this to the value mentioned in the logs after the first run. Watch the logs and double the value if needed. +# Find more details here: https://gitlab.servus.at/aura/engine-core/-/blob/master/docs/audio-device-configuration.md set("frame.audio.size", 0) -# set("frame.audio.size", 7526) + set("frame.video.framerate", 0) -input_analog = input.alsa(id="analog_input", device="default", bufferize=false, start=true, fallible=true) -output.alsa(id="lineout", device="default", input_analog, bufferize=false, fallible=true) \ No newline at end of file +output.alsa(device="default", bufferize=false, input.alsa(device="default", bufferize=false)) \ No newline at end of file diff --git a/tests/test_alsa_live_buffered.liq b/tests/test_alsa_live_buffered.liq new file mode 100644 index 0000000..1c9a849 --- /dev/null +++ b/tests/test_alsa_live_buffered.liq @@ -0,0 +1,35 @@ +#!/usr/bin/env liquidsoap +# +# Aura Engine (https://gitlab.servus.at/aura/engine) +# +# Copyright (C) 2017-now() - The Aura Engine Team. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + +set("init.allow_root", true) +set("init.catch_exn", false) +set("log.file.path", "../logs/<script>.log") +set("log.level", 5) +set("ffmpeg.log.level", 5) +set("audio.converter.samplerate.converters", ["ffmpeg"]) + +# Successfully tested with Liquidsoap 1.1.4 & ALSA 1.2.4 +# Low latency, no buffer underruns +set("frame.audio.size", 2048) +set("alsa.alsa_buffer", 8192) +set("alsa.buffer_length", 10) + +input_analog = input.alsa(device="default", bufferize=true) +output.alsa(device="default", input_analog, bufferize=true) \ No newline at end of file diff --git a/tests/test_alsa_live_double_buffered.liq b/tests/test_alsa_live_double_buffered.liq new file mode 100644 index 0000000..37571c4 --- /dev/null +++ b/tests/test_alsa_live_double_buffered.liq @@ -0,0 +1,37 @@ +#!/usr/bin/env liquidsoap +# +# Aura Engine (https://gitlab.servus.at/aura/engine) +# +# Copyright (C) 2017-now() - The Aura Engine Team. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + +set("init.allow_root", true) +set("init.catch_exn", false) +set("log.file.path", "../logs/<script>.log") +set("log.level", 5) +set("ffmpeg.log.level", 5) +set("audio.converter.samplerate.converters", ["ffmpeg"]) + +# Successfully tested with Liquidsoap 1.4.4 + 1.1.3 +# High latency, no buffer underruns +set("audio.converter.samplerate.converters", ["ffmpeg"]) +set("frame.audio.size", 2048) +set("alsa.alsa_buffer", 8192) +set("alsa.buffer_length", 10) + +input_analog = input.alsa(device="default", bufferize=true) +input_analog = mksafe(buffer(input_analog)) +output.alsa(device="default", input_analog, bufferize=true) \ No newline at end of file diff --git a/tests/test_framesize.liq b/tests/test_alsa_live_unbuffered.liq old mode 100755 new mode 100644 similarity index 66% rename from tests/test_framesize.liq rename to tests/test_alsa_live_unbuffered.liq index 95042b7..8e3ac24 --- a/tests/test_framesize.liq +++ b/tests/test_alsa_live_unbuffered.liq @@ -19,8 +19,17 @@ set("init.allow_root", true) +set("init.catch_exn", false) set("log.file.path", "../logs/<script>.log") +set("log.level", 5) +set("ffmpeg.log.level", 5) +set("audio.converter.samplerate.converters", ["ffmpeg"]) -set("frame.audio.size", 0) +# Successfully tested with Liquidsoap 2 & ALSA 1.2.4 +# Almost no latency, no buffer underruns +# Doesn't work in Liquidsoap 1.4 because of some calculation bug +set("frame.audio.size", 7526) set("frame.video.framerate", 0) -input.alsa(device="default", bufferize=false) \ No newline at end of file + +input_analog = input.alsa(device="default", bufferize=false) +output.alsa(device="default", input_analog, bufferize=false) \ No newline at end of file -- GitLab