From 43359b92441618f5c8d467f6ec2cf5b145a039ee Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 23 Aug 2013 12:07:55 +0200 Subject: [PATCH] tests: add retransmission example --- tests/examples/rtp/client-H264-rtx.sh | 42 +++++++++++++++++++++++++++ tests/examples/rtp/server-VTS-H264-rtx.sh | 47 +++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100755 tests/examples/rtp/client-H264-rtx.sh create mode 100755 tests/examples/rtp/server-VTS-H264-rtx.sh diff --git a/tests/examples/rtp/client-H264-rtx.sh b/tests/examples/rtp/client-H264-rtx.sh new file mode 100755 index 0000000..3293cba --- /dev/null +++ b/tests/examples/rtp/client-H264-rtx.sh @@ -0,0 +1,42 @@ +#!/bin/sh +# +# A simple RTP receiver with retransmission +# +# receives H264 encoded RTP video on port 5000, RTCP is received on port 5001. +# the receiver RTCP reports are sent to port 5005 +# +# .-------. .----------. .---------. .-------. .-----------. +# RTP |udpsrc | | rtpbin | |h264depay| |h264dec| |xvimagesink| +# port=5000 | src->recv_rtp recv_rtp->sink src->sink src->sink | +# '-------' | | '---------' '-------' '-----------' +# | | +# | | .-------. +# | | |udpsink| RTCP +# | send_rtcp->sink | port=5005 +# .-------. | | '-------' sync=false +# RTCP |udpsrc | | | async=false +# port=5001 | src->recv_rtcp | +# '-------' '----------' + + +# the caps of the sender RTP stream. This is usually negotiated out of band with +# SDP or RTSP. normally these caps will also include SPS and PPS but we don't +# have a mechanism to get this from the sender with a -launch line. +VIDEO_CAPS="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264" + +VIDEO_DEC="queue ! rtph264depay ! avdec_h264" + +VIDEO_SINK="videoconvert ! autovideosink" + +# the destination machine to send RTCP to. This is the address of the sender and +# is used to send back the RTCP reports of this receiver. If the data is sent +# from another machine, change this address. +DEST=127.0.0.1 + +LATENCY=200 + +gst-launch-1.0 -v rtpbin name=rtpbin latency=$LATENCY do-retransmission=1 \ + udpsrc caps=$VIDEO_CAPS port=5000 ! rtpbin.recv_rtp_sink_0 \ + rtpbin. ! $VIDEO_DEC ! $VIDEO_SINK \ + udpsrc port=5001 ! rtpbin.recv_rtcp_sink_0 \ + rtpbin.send_rtcp_src_0 ! udpsink port=5005 host=$DEST sync=false async=false diff --git a/tests/examples/rtp/server-VTS-H264-rtx.sh b/tests/examples/rtp/server-VTS-H264-rtx.sh new file mode 100755 index 0000000..40d860c --- /dev/null +++ b/tests/examples/rtp/server-VTS-H264-rtx.sh @@ -0,0 +1,47 @@ +#!/bin/sh +# +# A simple RTP server with retransmission +# sends the output of videotestsrc as h264 encoded RTP on port 5000, RTCP is sent on +# port 5001. The destination is 127.0.0.1. +# the video receiver RTCP reports are received on port 5005 +# +# .-------. .-------. .-------. .----------. .-------. +# |videots| |h264enc| |h264pay| | rtpbin | |udpsink| RTP +# | src->sink src->sink src->send_rtp send_rtp->sink | port=5000 +# '-------' '-------' '-------' | | '-------' +# | | +# | | .-------. +# | | |udpsink| RTCP +# | send_rtcp->sink | port=5001 +# .-------. | | '-------' sync=false +# RTCP |udpsrc | | | async=false +# port=5005 | src->recv_rtcp | +# '-------' '----------' +# +# ideally we should transport the properties on the RTP udpsink pads to the +# receiver in order to transmit the SPS and PPS earlier. + +# change this to send the RTP data and RTCP to another host +DEST=127.0.0.1 + +# tuning parameters to make the sender send the streams out of sync. Can be used +# ot test the client RTCP synchronisation. +#VOFFSET=900000000 +VOFFSET=0 +AOFFSET=0 + +# H264 encode from the source +VELEM="videotestsrc is-live=1 horizontal-speed=1" +VCAPS="video/x-raw,width=352,height=288,framerate=15/1" +VSOURCE="$VELEM ! $VCAPS" +VENC="x264enc tune=zerolatency bitrate=300 ! rtph264pay config-interval=2" + +VRTPSINK="udpsink port=5000 host=$DEST ts-offset=$VOFFSET name=vrtpsink" +VRTCPSINK="udpsink port=5001 host=$DEST sync=false async=false name=vrtcpsink" +VRTCPSRC="udpsrc port=5005 name=vrtpsrc" + +gst-launch-1.0 -v rtpbin name=rtpbin \ + $VSOURCE ! $VENC ! rtprtxqueue ! rtpbin.send_rtp_sink_0 \ + rtpbin.send_rtp_src_0 ! identity drop-probability=0.1 ! $VRTPSINK \ + rtpbin.send_rtcp_src_0 ! $VRTCPSINK \ + $VRTCPSRC ! rtpbin.recv_rtcp_sink_0 -- 2.7.4