summaryrefslogtreecommitdiff
path: root/roles/streaming/dolmetsch-raspi
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2021-07-30 22:10:52 +0200
committerChristian Pointner <equinox@spreadspace.org>2021-07-30 22:10:52 +0200
commit2c71bfe6363f5fe9186eeca48384052d3c6cd741 (patch)
tree44c40fbb26b6ba3e1402a45f8efae2f4d0b59e51 /roles/streaming/dolmetsch-raspi
parentmove dolmetsch-raspi to generic folder (diff)
cleanup dolmetsch-raspi role
Diffstat (limited to 'roles/streaming/dolmetsch-raspi')
-rw-r--r--roles/streaming/dolmetsch-raspi/defaults/main.yml7
-rw-r--r--roles/streaming/dolmetsch-raspi/tasks/main.yml50
-rw-r--r--roles/streaming/dolmetsch-raspi/templates/dolmetschctl.service.j23
-rw-r--r--roles/streaming/dolmetsch-raspi/templates/rtp-recv.service.j23
-rw-r--r--roles/streaming/dolmetsch-raspi/templates/rtp-recv.sh.j27
-rw-r--r--roles/streaming/dolmetsch-raspi/templates/rtp-send.service.j23
-rw-r--r--roles/streaming/dolmetsch-raspi/templates/rtp-send.sh.j22
7 files changed, 40 insertions, 35 deletions
diff --git a/roles/streaming/dolmetsch-raspi/defaults/main.yml b/roles/streaming/dolmetsch-raspi/defaults/main.yml
index 987a0481..4130fdf0 100644
--- a/roles/streaming/dolmetsch-raspi/defaults/main.yml
+++ b/roles/streaming/dolmetsch-raspi/defaults/main.yml
@@ -1,3 +1,10 @@
---
dolmetsch_raspi_golang_version: 1.11.5
dolmetsch_raspi_golang_checksum: "sha256:b26b53c94923f78955236386fee0725ef4e76b6cb47e0df0ed0c0c4724e7b198"
+
+# dolmetsch_raspi_server_address:
+# dolmetsch_raspi_client_address:
+
+### latency is measured in ms
+dolmetsch_raspi_recv_latency: 50
+dolmetsch_raspi_send_alsa_device: "hw:CODEC"
diff --git a/roles/streaming/dolmetsch-raspi/tasks/main.yml b/roles/streaming/dolmetsch-raspi/tasks/main.yml
index 10d55766..2240d211 100644
--- a/roles/streaming/dolmetsch-raspi/tasks/main.yml
+++ b/roles/streaming/dolmetsch-raspi/tasks/main.yml
@@ -2,14 +2,14 @@
- name: install packages
apt:
name:
- - gstreamer1.0-tools
- - gstreamer1.0-plugins-base
- - gstreamer1.0-plugins-good
- - gstreamer1.0-plugins-bad
- - gstreamer1.0-alsa
- - git
- - libasound2-dev
- - telnet
+ - gstreamer1.0-tools
+ - gstreamer1.0-plugins-base
+ - gstreamer1.0-plugins-good
+ - gstreamer1.0-plugins-bad
+ - gstreamer1.0-alsa
+ - git
+ - libasound2-dev
+ - telnet
- name: download golang tarball
get_url:
@@ -27,16 +27,16 @@
- name: update golang installation
when: golang_version is failed or golang_version.stdout != ("go version go" + dolmetsch_raspi_golang_version + " linux/arm")
block:
- - name: remove old golang installation
- file:
- path: /usr/local/go
- state: absent
+ - name: remove old golang installation
+ file:
+ path: /usr/local/go
+ state: absent
- - name: extract the golang tarball
- unarchive:
- src: "/usr/local/src/go{{ dolmetsch_raspi_golang_version }}.linux-armv6l.tar.gz"
- dest: /usr/local
- copy: no
+ - name: extract the golang tarball
+ unarchive:
+ src: "/usr/local/src/go{{ dolmetsch_raspi_golang_version }}.linux-armv6l.tar.gz"
+ dest: /usr/local
+ copy: no
- name: prepare dolmetschctl install path
file:
@@ -45,8 +45,8 @@
- name: build dolmetschctl (server and client)
loop:
- - dolmetschctl
- - dolmetschctld
+ - dolmetschctl
+ - dolmetschctld
command: "/usr/local/go/bin/go get spreadspace.org/dolmetschctl/cmd/{{ item }}"
args:
creates: "/opt/dolmetschctl/bin/{{ item }}"
@@ -55,8 +55,8 @@
- name: install dolmetschctl systemd units
loop:
- - dolmetschctl
- - dolmetschctld
+ - dolmetschctl
+ - dolmetschctld
template:
src: "{{ item }}.service.j2"
dest: "/etc/systemd/system/{{ item }}.service"
@@ -64,8 +64,8 @@
- name: install rtp send/receive scripts
loop:
- - rtp-recv
- - rtp-send
+ - rtp-recv
+ - rtp-send
template:
src: "{{ item }}.sh.j2"
dest: "/usr/local/bin/{{ item }}.sh"
@@ -73,8 +73,8 @@
- name: install rtp send/receive systemd units
loop:
- - rtp-recv
- - rtp-send
+ - rtp-recv
+ - rtp-send
template:
src: "{{ item }}.service.j2"
dest: "/etc/systemd/system/{{ item }}.service"
diff --git a/roles/streaming/dolmetsch-raspi/templates/dolmetschctl.service.j2 b/roles/streaming/dolmetsch-raspi/templates/dolmetschctl.service.j2
index cd97cc3e..909c8570 100644
--- a/roles/streaming/dolmetsch-raspi/templates/dolmetschctl.service.j2
+++ b/roles/streaming/dolmetsch-raspi/templates/dolmetschctl.service.j2
@@ -2,8 +2,7 @@
Description=dolmetschctl Client
[Service]
-{# TODO: remove hardcoded IP #}
-ExecStart=/opt/dolmetschctl/bin/dolmetschctl 192.168.48.102:8234
+ExecStart=/opt/dolmetschctl/bin/dolmetschctl {{ dolmetsch_raspi_server_address }}:8234
Restart=always
RestartSecs=1s
StartLimitBurst=10
diff --git a/roles/streaming/dolmetsch-raspi/templates/rtp-recv.service.j2 b/roles/streaming/dolmetsch-raspi/templates/rtp-recv.service.j2
index b338ff65..be655128 100644
--- a/roles/streaming/dolmetsch-raspi/templates/rtp-recv.service.j2
+++ b/roles/streaming/dolmetsch-raspi/templates/rtp-recv.service.j2
@@ -2,8 +2,7 @@
Description=RTP Receiver
[Service]
-{# TODO: remove hardcoded IP #}
-ExecStart=/usr/local/bin/rtp-recv.sh 192.168.48.103
+ExecStart=/usr/local/bin/rtp-recv.sh {{ dolmetsch_raspi_client_address }} {{ dolmetsch_raspi_recv_latency }}
Restart=always
RestartSecs=1s
StartLimitBurst=10
diff --git a/roles/streaming/dolmetsch-raspi/templates/rtp-recv.sh.j2 b/roles/streaming/dolmetsch-raspi/templates/rtp-recv.sh.j2
index c9a89f95..1cbd08ea 100644
--- a/roles/streaming/dolmetsch-raspi/templates/rtp-recv.sh.j2
+++ b/roles/streaming/dolmetsch-raspi/templates/rtp-recv.sh.j2
@@ -1,13 +1,14 @@
#!/bin/bash
HOST="$1"
-if [ -z "$HOST" ]; then
- echo "usage: $0 <remote-host>"
+LATENCY="$2"
+if [ -z "$HOST" ] || [ -z "$LATENCY" ]; then
+ echo "usage: $0 <remote-host> <latency-ms>"
exit 1
fi
#export GST_DEBUG=3
-exec gst-launch-1.0 rtpbin name=rtpbin latency=50 \
+exec gst-launch-1.0 rtpbin name=rtpbin "latency=$LATENCY" \
udpsrc port=5000 caps="application/x-rtp,media=(string)audio,encoding-name=(string)OPUS,clock-rate=(int)48000" ! rtpbin.recv_rtp_sink_0 \
rtpbin. ! rtpopusdepay ! opusdec ! alsasink \
udpsrc port=5001 ! rtpbin.recv_rtcp_sink_0 \
diff --git a/roles/streaming/dolmetsch-raspi/templates/rtp-send.service.j2 b/roles/streaming/dolmetsch-raspi/templates/rtp-send.service.j2
index 40a029ab..090bb80a 100644
--- a/roles/streaming/dolmetsch-raspi/templates/rtp-send.service.j2
+++ b/roles/streaming/dolmetsch-raspi/templates/rtp-send.service.j2
@@ -2,8 +2,7 @@
Description=RTP Sender
[Service]
-{# TODO: remove hardcoded IP #}
-ExecStart=/usr/local/bin/rtp-send.sh 192.168.48.102
+ExecStart=/usr/local/bin/rtp-send.sh {{ dolmetsch_raspi_server_address }}
Restart=always
RestartSecs=1s
StartLimitBurst=10
diff --git a/roles/streaming/dolmetsch-raspi/templates/rtp-send.sh.j2 b/roles/streaming/dolmetsch-raspi/templates/rtp-send.sh.j2
index 9754b620..a0dba99a 100644
--- a/roles/streaming/dolmetsch-raspi/templates/rtp-send.sh.j2
+++ b/roles/streaming/dolmetsch-raspi/templates/rtp-send.sh.j2
@@ -8,7 +8,7 @@ fi
#export GST_DEBUG=3
exec gst-launch-1.0 rtpbin name=rtpbin \
- alsasrc device=hw:CODEC ! 'audio/x-raw,rate=48000,channels=1' ! opusenc ! rtpopuspay ! rtpbin.send_rtp_sink_0 \
+ alsasrc device='{{ dolmetsch_raspi_send_alsa_device }}' ! 'audio/x-raw,rate=48000,channels=1' ! opusenc ! rtpopuspay ! rtpbin.send_rtp_sink_0 \
rtpbin.send_rtp_src_0 ! udpsink "host=$HOST" port=5000 \
rtpbin.send_rtcp_src_0 ! udpsink "host=$HOST" port=5001 sync=false async=false \
udpsrc port=5001 ! rtpbin.recv_rtcp_sink_0