Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
rambo committed Jan 25, 2011
1 parent 2eafb7e commit 85f2340
Show file tree
Hide file tree
Showing 2 changed files with 142 additions and 0 deletions.
64 changes: 64 additions & 0 deletions software/gst-tests/client-H264-PCMA.sh
@@ -0,0 +1,64 @@
#!/bin/sh
#
# A simple RTP receiver
#
# receives H264 encoded RTP video on port 5000, RTCP is received on port 5001.
# the receiver RTCP reports are sent to port 5005
# receives alaw encoded RTP audio on port 5002, RTCP is received on port 5003.
# the receiver RTCP reports are sent to port 5007
#
# .-------. .----------. .---------. .-------. .-----------.
# 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 |
# '-------' | |
# | |
# .-------. | | .---------. .-------. .--------.
# RTP |udpsrc | | rtpbin | |pcmadepay| |alawdec| |autoaudiosink|
# port=5002 | src->recv_rtp recv_rtp->sink src->sink src->sink |
# '-------' | | '---------' '-------' '--------'
# | |
# | | .-------.
# | | |udpsink| RTCP
# | send_rtcp->sink | port=5007
# .-------. | | '-------' sync=false
# RTCP |udpsrc | | | async=false
# port=5003 | src->recv_rtcp |
# '-------' '----------'

# 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

# this adjusts the latency in the receiver
LATENCY=200

# 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"
AUDIO_CAPS="application/x-rtp,media=(string)audio,clock-rate=(int)8000,encoding-name=(string)PCMA"

VIDEO_DEC="rtph264depay ! ffdec_h264"
AUDIO_DEC="rtppcmadepay ! alawdec"

VIDEO_SINK="ffmpegcolorspace ! autovideosink"
AUDIO_SINK="audioconvert ! audioresample ! autoaudiosink"

gst-launch -v gstrtpbin name=rtpbin latency=$LATENCY \
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 \
udpsrc caps=$AUDIO_CAPS port=5002 ! rtpbin.recv_rtp_sink_1 \
rtpbin. ! $AUDIO_DEC ! $AUDIO_SINK \
udpsrc port=5003 ! rtpbin.recv_rtcp_sink_1 \
rtpbin.send_rtcp_src_1 ! udpsink port=5007 host=$DEST sync=false async=false
78 changes: 78 additions & 0 deletions software/gst-tests/server-v4l2-H264-alsasrc-PCMA.sh
@@ -0,0 +1,78 @@
#!/bin/sh
#
# A simple RTP server
# sends the output of v4l2src 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
# sends the output of autoaudiosrc as alaw encoded RTP on port 5002, RTCP is sent on
# port 5003. The destination is 127.0.0.1.
# the receiver RTCP reports are received on port 5007
#
# .-------. .-------. .-------. .----------. .-------.
# |v4lssrc| |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 |
# '-------' | |
# | |
# .-------. .-------. .-------. | | .-------.
# |autoaudiosrc| |alawenc| |pcmapay| | rtpbin | |udpsink| RTP
# | src->sink src->sink src->send_rtp send_rtp->sink | port=5002
# '-------' '-------' '-------' | | '-------'
# | |
# | | .-------.
# | | |udpsink| RTCP
# | send_rtcp->sink | port=5003
# .-------. | | '-------' sync=false
# RTCP |udpsrc | | | async=false
# port=5007 | 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="v4l2src"
VELEM="videotestsrc is-live=1"
VCAPS="video/x-raw-yuv,width=352,height=288,framerate=15/1"
VSOURCE="$VELEM ! $VCAPS ! queue ! videorate ! ffmpegcolorspace"
VENC="x264enc tune=zerolatency 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"

# PCMA encode from the source
#AELEM="autoaudiosrc"
AELEM="audiotestsrc is-live=1"
ASOURCE="$AELEM ! queue ! audioresample ! audioconvert"
AENC="alawenc ! rtppcmapay"

ARTPSINK="udpsink port=5002 host=$DEST ts-offset=$AOFFSET name=artpsink"
ARTCPSINK="udpsink port=5003 host=$DEST sync=false async=false name=artcpsink"
ARTCPSRC="udpsrc port=5007 name=artpsrc"

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 \
$ASOURCE ! $AENC ! rtpbin.send_rtp_sink_1 \
rtpbin.send_rtp_src_1 ! $ARTPSINK \
rtpbin.send_rtcp_src_1 ! $ARTCPSINK \
$ARTCPSRC ! rtpbin.recv_rtcp_sink_1

0 comments on commit 85f2340

Please sign in to comment.