From 61ba220b60087b62410b6709005f8ddfbdd711d6 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Thu, 11 May 2017 11:45:15 +0200 Subject: Normalize device loop. --- bin/recv-gst-rtp-v-a | 10 ++++++---- bin/send-gst-rtp-v-a | 7 ++++--- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'bin') diff --git a/bin/recv-gst-rtp-v-a b/bin/recv-gst-rtp-v-a index 2289d04..1da2106 100755 --- a/bin/recv-gst-rtp-v-a +++ b/bin/recv-gst-rtp-v-a @@ -4,8 +4,8 @@ set -e CAMIP=${CAMIP:-$1} # origin host - default: use multicast group -VCOUNT=${VCOUNT:-$2} # number of video stream(s) to display - default: 1 -ACOUNT=${ACOUNT:-$3} # number of audio stream(s) to play - default: 0 +VCOUNT=${VCOUNT:-${2:-1}} # number of video stream(s) to display - default: 1 +ACOUNT=${ACOUNT:-${3:-0}} # number of audio stream(s) to play - default: 0 VFORMAT=${VFORMAT:-$4} # H264 VP8 RAW - default: RAW AFORMAT=${AFORMAT:-$5} # AMR OPUS RAW - default: RAW VSINK=${VSINK:-autovideosink} @@ -76,5 +76,7 @@ stream() { gst-launch-1.0 -v \ rtpbin name=rtpbin latency=$NETLATENCY drop-on-latency=true \ - $(for i in $(seq "${VCOUNT:-1}"); do stream "$i" "$VCAPS" "$VDEC ! $VSINK"; done) \ - $(for j in $(seq "${ACOUNT:-0}"); do stream $((VCOUNT+j)) "$ACAPS" "$ADEC ! $ASINK buffer-time=$ABUFFERS"; done) + $(n=0;\ + for i in $(seq "$VCOUNT"); do n=$((n+1)); stream "$n" "$VCAPS" "$VDEC ! $VSINK"; done;\ + for i in $(seq "$ACOUNT"); do n=$((n+1)); stream "$n" "$ACAPS" "$ADEC ! $ASINK buffer-time=$ABUFFERS"; done;\ + ) diff --git a/bin/send-gst-rtp-v-a b/bin/send-gst-rtp-v-a index f79da8b..f8b548b 100755 --- a/bin/send-gst-rtp-v-a +++ b/bin/send-gst-rtp-v-a @@ -79,10 +79,11 @@ stream() { ! rtpbin."recv_rtcp_sink_$ID" } -n=0 gst-launch-1.0 -v \ rtpbin name=rtpbin \ - $(for dev in $VDEVICES; do n=$((n+1)); stream "$n" "v4l2src device=$dev ! $QUEUE ! videoconvert ! $VCAPS ! $QUEUE ! $VENC ! $QUEUE"; done; \ - for dev in $ADEVICES; do n=$((n+1)); stream "$n" "alsasrc device=$dev buffer-time=$ABUFFERS ! $QUEUE ! audioconvert ! $QUEUE ! $AENC ! $QUEUE"; done) + $(n=0;\ + for dev in $VDEVICES; do n=$((n+1)); stream "$n" "v4l2src device=$dev ! $QUEUE ! videoconvert ! $VCAPS ! $QUEUE ! $VENC ! $QUEUE"; done;\ + for dev in $ADEVICES; do n=$((n+1)); stream "$n" "alsasrc device=$dev buffer-time=$ABUFFERS ! $QUEUE ! audioconvert ! $QUEUE ! $AENC ! $QUEUE"; done;\ + ) set -e -- cgit v1.2.3