summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2019-02-24 23:33:03 +0100
committerChristian Pointner <equinox@spreadspace.org>2019-02-24 23:33:03 +0100
commit02ec06495725fc351011831bc28117487db05ccd (patch)
treeecbebad4d7e92464c85c212942a132490701c623
parentadded sytemd units for forlmetschctl(d) (diff)
added dolmetsch rtp send/receive scripts
-rw-r--r--roles/elevate/dolmetsch-raspi/tasks/main.yml18
-rw-r--r--roles/elevate/dolmetsch-raspi/templates/rtp-recv.service.j218
-rw-r--r--roles/elevate/dolmetsch-raspi/templates/rtp-recv.sh.j214
-rw-r--r--roles/elevate/dolmetsch-raspi/templates/rtp-send.service.j218
-rw-r--r--roles/elevate/dolmetsch-raspi/templates/rtp-send.sh.j214
5 files changed, 82 insertions, 0 deletions
diff --git a/roles/elevate/dolmetsch-raspi/tasks/main.yml b/roles/elevate/dolmetsch-raspi/tasks/main.yml
index c98b0ff4..e0e1083c 100644
--- a/roles/elevate/dolmetsch-raspi/tasks/main.yml
+++ b/roles/elevate/dolmetsch-raspi/tasks/main.yml
@@ -61,3 +61,21 @@
src: "{{ item }}.service.j2"
dest: "/etc/systemd/system/{{ item }}.service"
notify: reload systemd
+
+- name: install rtp send/receive scripts
+ with_items:
+ - rtp-recv
+ - rtp-send
+ template:
+ src: "{{ item }}.sh.j2"
+ dest: "/usr/local/bin/{{ item }}.sh"
+ mode: 0750
+
+- name: install rtp send/receive systemd units
+ with_items:
+ - rtp-recv
+ - rtp-send
+ template:
+ src: "{{ item }}.service.j2"
+ dest: "/etc/systemd/system/{{ item }}.service"
+ notify: reload systemd
diff --git a/roles/elevate/dolmetsch-raspi/templates/rtp-recv.service.j2 b/roles/elevate/dolmetsch-raspi/templates/rtp-recv.service.j2
new file mode 100644
index 00000000..4f7cf889
--- /dev/null
+++ b/roles/elevate/dolmetsch-raspi/templates/rtp-recv.service.j2
@@ -0,0 +1,18 @@
+[Unit]
+Description=RTP Receiver
+
+[Service]
+{# TODO: remove hardcoded IP #}
+ExecStart=/usr/local/bin/rtp-recv.sh 192.168.48.103
+CapabilityBoundingSet=CAP_NET_BIND_SERVICE
+NoNewPrivileges=yes
+PrivateTmp=yes
+ProtectSystem=strict
+ProtectHome=yes
+ProtectKernelTunables=yes
+ProtectControlGroups=yes
+RestrictRealtime=yes
+RestrictAddressFamilies=AF_INET AF_INET6
+
+[Install]
+WantedBy=multi-user.target
diff --git a/roles/elevate/dolmetsch-raspi/templates/rtp-recv.sh.j2 b/roles/elevate/dolmetsch-raspi/templates/rtp-recv.sh.j2
new file mode 100644
index 00000000..c9a89f95
--- /dev/null
+++ b/roles/elevate/dolmetsch-raspi/templates/rtp-recv.sh.j2
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+HOST="$1"
+if [ -z "$HOST" ]; then
+ echo "usage: $0 <remote-host>"
+ exit 1
+fi
+
+#export GST_DEBUG=3
+exec gst-launch-1.0 rtpbin name=rtpbin latency=50 \
+ 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 \
+ rtpbin.send_rtcp_src_0 ! udpsink "host=$HOST" port=5001 sync=false async=false
diff --git a/roles/elevate/dolmetsch-raspi/templates/rtp-send.service.j2 b/roles/elevate/dolmetsch-raspi/templates/rtp-send.service.j2
new file mode 100644
index 00000000..47903afd
--- /dev/null
+++ b/roles/elevate/dolmetsch-raspi/templates/rtp-send.service.j2
@@ -0,0 +1,18 @@
+[Unit]
+Description=RTP Sender
+
+[Service]
+{# TODO: remove hardcoded IP #}
+ExecStart=/usr/local/bin/rtp-send.sh 192.168.48.102
+CapabilityBoundingSet=CAP_NET_BIND_SERVICE
+NoNewPrivileges=yes
+PrivateTmp=yes
+ProtectSystem=strict
+ProtectHome=yes
+ProtectKernelTunables=yes
+ProtectControlGroups=yes
+RestrictRealtime=yes
+RestrictAddressFamilies=AF_INET AF_INET6
+
+[Install]
+WantedBy=multi-user.target
diff --git a/roles/elevate/dolmetsch-raspi/templates/rtp-send.sh.j2 b/roles/elevate/dolmetsch-raspi/templates/rtp-send.sh.j2
new file mode 100644
index 00000000..9754b620
--- /dev/null
+++ b/roles/elevate/dolmetsch-raspi/templates/rtp-send.sh.j2
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+HOST="$1"
+if [ -z "$HOST" ]; then
+ echo "usage: $0 <remote-host>"
+ exit 1
+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 \
+ 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