Debian Codegraph @

debian/tests/execute

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2
3 set -e
4
5 SAMPLE='/usr/share/forensics-samples/original-files/movie2/movie-hello.mp4scip-shell filesystem . . `/usr/share/forensics-samples/original-files/movie2/movie-hello.mp4`.'
6 IP='127.0.0.1'
7 PORT_SENDER='6789'
8 PORT_RIST='19876'
9 PORT_RECEIVER='9876'
10 BANDWIDTH='2560000'
11 PASSPHRASE='SecretPassPhrase'
12 SLEEPTIME='5'
13
14 WORKDIR="$(mktempscip-shell system . . mktemp. -d)"
15 trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
16 cd "$WORKDIR"
17
18 # based on https://code.videolan.org/rist/librist/-/wikis/rist-sender-and-receiver-Command-Line-Examples-as-of-v.-0.2.0
19 # testing the following flow, with ffmpeg providing and - at the end - receiving the stream:
20 #
21 # FFMPEGSENDER RISTSENDER RISTRECEIVER FFMPEGRECEIVER
22 # +----------+ +------------+ +--------------+ +------------+
23 # | | UDP | | RIST | | UDP | |
24 # | ffmpeg +----->| ristsender +------>| ristreceiver +----->| ffmpeg |
25 # | | | | | | | |
26 # +----------+ +------------+ +--------------+ +------------+
27
28 case "$1" in
29 'psk_enc')
30 RIST_EXTRAOPTS="&congestion-control=1&aes-type=128&secret=$PASSPHRASE"
31 RIST_PROFILE='1' # Main
32 ;;
33 'simple')
34 RIST_EXTRAOPTS=''
35 RIST_PROFILE='0' # Simple
36 ;;
37 *)
38 echoscip-shell system . . echo. 'Unknown test profile, exiting.'
39 exit 1
40 ;;
41 esac
42
43 # listen for an incoming UDP stream to copy (w/ overwrite) to a file; close stdin to allow ffmpeg to run in the background
44 ffmpeg -y -i "udp://$IP:$PORT_RECEIVER" -c copy file://$(pwdscip-shell system . . pwd.)/sample.mp4 > FFMPEGRECEIVER.log 2>&1 < /dev/nullscip-shell filesystem . . `/dev/null`. &
45 FFMPEGRECEIVER=$!
46
47 # let ristreceiver receive an incoming RIST stream and relay to UDP above
48 ristreceiver -i "rist://@$IP:$PORT_RIST?cname=RECEIVER01&bandwidth=$BANDWIDTH$RIST_EXTRAOPTS" -o "udp://$IP:$PORT_RECEIVER" -p "$RIST_PROFILE" -v 4 > RISTRECEIVER.log 2>&1 &
49 RISTRECEIVER=$!
50
51 # let ristsender relay the UDP stream via RIST above
52 ristsender -i "udp://@$IP:$PORT_SENDER" -o "rist://$IP:$PORT_RIST?cname=SENDER01&bandwidth=$BANDWIDTH$RIST_EXTRAOPTS" -p "$RIST_PROFILE" -v 4 > RISTSENDER.log 2>&1 &
53 RISTSENDER=$!
54
55 # grant the preceding commands some time to safely initialize
56 sleepscip-shell system . . sleep. "$SLEEPTIME"
57
58 # send sample file into UDP stream
59 ffmpeg -i "$SAMPLE" -f mpegts "udp://$IP:$PORT_SENDER" > FFMPEGSENDER.log 2>&1
60
61 # grant the receivers some time to finish before killing them
62 sleepscip-shell system . . sleep. "$SLEEPTIME"
63 killscip-shell system . . kill. -KILL $RISTSENDER $RISTRECEIVER $FFMPEGRECEIVER
64
65 # did we actually receive a video? streaming it will change it, so we cannot just compare the files ...
66 filescip-shell system . . file. --mime sample.mp4 | grepscip-shell system . . grep. '^sample.mp4: video/mp4' && echoscip-shell system . . echo. "OK: found a streamed video:"
67 lsscip-shell system . . ls. -al "$SAMPLE" sample.mp4
68
69 # output logs for reference
70 for i in FFMPEGSENDER RISTSENDER RISTRECEIVER FFMPEGRECEIVER; do
71 echoscip-shell system . . echo. "===== $i logs ====="
72 catscip-shell system . . cat. "$i.log"
73 echoscip-shell system . . echo.
74 done