1#!/bin/sh
2#
3# A simple RTP receiver
4#
5#  receives alaw encoded RTP audio on port 5002, RTCP is received on  port 5003.
6#  the receiver RTCP reports are sent to port 5007
7#
8#             .-------.      .----------.     .---------.   .-------.   .-------------.
9#  RTP        |udpsrc |      | rtpbin   |     |pcmadepay|   |alawdec|   |autoaudiosink|
10#  port=5002  |      src->recv_rtp recv_rtp->sink     src->sink   src->sink           |
11#             '-------'      |          |     '---------'   '-------'   '-------------'
12#                            |          |
13#                            |          |     .-------.
14#                            |          |     |udpsink|  RTCP
15#                            |    send_rtcp->sink     | port=5007
16#             .-------.      |          |     '-------' sync=false
17#  RTCP       |udpsrc |      |          |               async=false
18#  port=5003  |     src->recv_rtcp      |
19#             '-------'      '----------'
20
21
22# the caps of the sender RTP stream. This is usually negotiated out of band with
23# SDP or RTSP.
24AUDIO_CAPS="application/x-rtp,media=(string)audio,clock-rate=(int)8000,encoding-name=(string)PCMA"
25
26AUDIO_DEC="rtppcmadepay ! alawdec"
27
28AUDIO_SINK="audioconvert ! audioresample ! autoaudiosink"
29
30# the destination machine to send RTCP to. This is the address of the sender and
31# is used to send back the RTCP reports of this receiver. If the data is sent
32# from another machine, change this address.
33DEST=127.0.0.1
34
35gst-launch-1.0 -v rtpbin name=rtpbin                                                \
36	   udpsrc caps=$AUDIO_CAPS port=5002 ! rtpbin.recv_rtp_sink_0              \
37	         rtpbin. ! $AUDIO_DEC ! $AUDIO_SINK                                \
38           udpsrc port=5003 ! rtpbin.recv_rtcp_sink_0                              \
39         rtpbin.send_rtcp_src_0 ! udpsink port=5007 host=$DEST sync=false async=false
40