From 2c71bfe6363f5fe9186eeca48384052d3c6cd741 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 30 Jul 2021 22:10:52 +0200 Subject: cleanup dolmetsch-raspi role --- inventory/group_vars/ele-dolmetsch-raspi/vars.yml | 3 ++ inventory/group_vars/elevate-festival/vars.yml | 6 --- roles/streaming/dolmetsch-raspi/defaults/main.yml | 7 +++ roles/streaming/dolmetsch-raspi/tasks/main.yml | 50 +++++++++++----------- .../templates/dolmetschctl.service.j2 | 3 +- .../dolmetsch-raspi/templates/rtp-recv.service.j2 | 3 +- .../dolmetsch-raspi/templates/rtp-recv.sh.j2 | 7 +-- .../dolmetsch-raspi/templates/rtp-send.service.j2 | 3 +- .../dolmetsch-raspi/templates/rtp-send.sh.j2 | 2 +- 9 files changed, 43 insertions(+), 41 deletions(-) diff --git a/inventory/group_vars/ele-dolmetsch-raspi/vars.yml b/inventory/group_vars/ele-dolmetsch-raspi/vars.yml index c440e448..501c8249 100644 --- a/inventory/group_vars/ele-dolmetsch-raspi/vars.yml +++ b/inventory/group_vars/ele-dolmetsch-raspi/vars.yml @@ -3,3 +3,6 @@ ssh_users_root: - equinox - datacop - nhg + +dolmetsch_raspi_server_address: "{{ network_zones.mixer.prefix | ipaddr(network_zones.mixer.offsets['ele-dol-raspi0']) | ipaddr('address/prefix') }}" +dolmetsch_raspi_client_address: "{{ network_zones.mixer.prefix | ipaddr(network_zones.mixer.offsets['ele-dol-raspi1']) | ipaddr('address/prefix') }}" diff --git a/inventory/group_vars/elevate-festival/vars.yml b/inventory/group_vars/elevate-festival/vars.yml index 87801f33..2b6242c0 100644 --- a/inventory/group_vars/elevate-festival/vars.yml +++ b/inventory/group_vars/elevate-festival/vars.yml @@ -128,10 +128,6 @@ network_zones: ele-sw-tub0: 90 ele-br-tub0: 99 # --> ele-br-nextlib0 - ### Dolmetsch - ele-dol-mixer: 200 - ele-dol-translator: 201 - ### UPS ele-ups-nextlib0: 210 ele-ups-nextlib1: 211 @@ -160,8 +156,6 @@ network_zones: hyperdeck-datacop: 91 atemctrl-datacop: 92 atemwinvm-datacop: 93 - ele-dol-mixer: 100 - ele-dol-translator: 101 ele-dol-raspi0: 102 ele-dol-raspi1: 103 atem-mini: 204 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 " +LATENCY="$2" +if [ -z "$HOST" ] || [ -z "$LATENCY" ]; then + echo "usage: $0 " 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 -- cgit v1.2.3