#!/bin/sh
# 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="v4l2src"
VELEM="videotestsrc is-live=1 horizontal-speed=1 pattern=smpte100 ! timeoverlay"
VCAPS="video/x-raw-yuv,width=352,height=288,framerate=25/1"
VSOURCE="$VELEM ! $VCAPS ! queue ! videorate ! ffmpegcolorspace"
VENC="x264enc byte-stream=true bitrate=300 ! rtph264pay"

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 -v gstrtpbin name=rtpbin \
    $VSOURCE ! $VENC ! rtpbin.send_rtp_sink_0                                             \
        rtpbin.send_rtp_src_0 ! $VRTPSINK                                                 \
        rtpbin.send_rtcp_src_0 ! $VRTCPSINK                                               \
      $VRTCPSRC ! rtpbin.recv_rtcp_sink_0
