Presentation OutlineIntroduction History of streaming media Overview of RTP What is RTP? Why RTP? How RTP work? RTP Features (Advantages) RTP Disadvantages RTP HeaderReal-time streaming protocol (RTSP)
Origin of Protocol(RTP) Developed by the Audio-Video Transport Working Group of the IETF “Internet Engineering Task Force” : H. Schulzrinne (Columbia University) S. Casner (Packet Design) R. Frederick (Blue Coat Systems Inc.) V. Jacobson (Packet Design) First published as RFC 1889 in the year 1996 Superseded by RFC 3550 in the year 2003
Real-Time Transport ProtocolEnd-to-end delivery services for applications transmitting real-timedata, such as audio and video over multicast and unicast networks.Application layer protocolTypically used on top of IP and UDP•Layer 4 – UDP or TCP•Layer 3 – Internet Protocol IP•Layer 7 – RTPApplications that use RTP are: Less sensitive to packet loss. Very sensitive to packet delays. E.x:- – Video teleconferencing – Internet Telephony (VoIP) – Internet audio, video streaming
RTP Features All RTP and RTCP PDUs are sent to same multicast group (by all participants)RTP supports several file formats like MPEG and MJPEG but you can add extra formats.RTP also has jitter compensation, multimedia streaming (tolerates packet loss)and detection of out of sequence arrival in data attributes. How RTP work?
Streaming performance requirements – Sequencing – to report PDU loss – to report PDU reordering – to perform out-of-order decoding – Time stamping and Buffering – for play out – for jitter and delay calculation – Payload type identification – for media interpretation – Error concealment –covers up errors from lost PDU by using redundancy in most- adjacent-frame – Quality of Service (QoS) feedback – from receiver to sender for operation adjustment – Rate control –sender reduces sending rate adaptively to network congestion
Ideal Timing – no jitter 00.00.00 00.00.10 application 00.00.11 00.00.20 00.00.21 00.00.30 00.00.31 Send time Play time
Reality – jitter 00.00.00 delay 00.00.10 00.00.11 00.00.20 00.00.21 00.00.30 00.00.2500.00.40 00.00.35 00.00.37 00.00.41 00.00.47 Send time 00.00.51 Play time
Jitter (contd.) 00.00.0000.00.10 00.00.1100.00.20 00.00.21 00.00.1800.00.30 00.00.25 00.00.2800.00.40 00.00.35 00.00.37 00.00.38 00.00.41 00.00.47 Send time 00.00.48 00.00.51 Play time 00.00.58
Jitter (contd.)Playback buffer At time 00:00:18 At time 00:00:28 At time 00:00:38
Support from transport layers Why not only RTP? RTP Does Not Assume the underlying network is reliable and delivers PDUs in sequence. Uses sequence number. Provide timely delivery or other QoS guarantees. However, it does provide necessary data to application to order packets and adjust signal quality. Relies on other protocols like RTCP and lower layers (e.g. UDP, TCP) to do so.Handle connection setups or tear-downs. Need other protocols like SIP or H.323Handle resource reservation . Need other protocols like RSVPDefine media data formats or encodings. Need media specific profiles.
Why not TCP? TCP does retransmissions unbounded delays due to (Acks, Flow control, windowing) No provision for time stamping TCP does not support multicast TCP congestion control (slow-start) unsuitable for real-time transport (A-V media)Why not UDP? UDP offers datagram-like service RTCP Connectionless , Unreliable , Unordered No Flow , Error , Congestion control Port numbers RTP + UDP usually used for multimedia services
RTP PDU Header Incremented by one for each RTPSampling instant of first data octet PDU:multiple PDUs can have same timestamp PDU loss detection Payload typenot necessarily monotonic Restore PDU sequenceused to synchronize differentmedia streams Identifies synchronization source Identifies contributing sources (used by mixers)
V - Version. 2 bits. P- padding .1bit X - Extension. 1 bit. CC - CSRC count. 4 bits. M - Marker. 1 bit. PT - Payload Type. 7 bits. Sequence Number. 16 bits. Timestamp. 32 bits. SSRC, Synchronization source. 32 bits.RTP Data Transfer Protocol : Synchronization CSRC, Contributing source. 32 bits. SSRC, Synchronization source. 32 bits. Sequence Number. 16 bits. (packet count) - gap in sequence #: packet loss Timestamp. 32 bits. • e.g., audio@8KHz, 20ms samples/packet - timestamp increment per packet: 160 • 90KHz used for video - a video frame may be encapsulated in a few packets • gap in timestamp: silenceRTP Data Transfer Protocol : RTP profilesMedia specific (e.g., audio) M - Marker. 1 bit. e.g., the start of a talk spurt PT - Payload Type. 7 bits. e.g., specific audio codec • PT=0: PCM 64Kbpz; PT=3: GSM 13Kbps • timestamp: e.g., sampling rate, 8KHz PCM • packet size: e.g., about 20ms samples in PCM - packets independent as much as possible: ALF
RTP Session RTP session is sending and receiving of RTP data by a group of participants For each participant, a session is a pair of transport addresses used to communicate with the group If multiple media types are communicated by the group, the transmission of eachmedium constitutes a session.
RTP Synchronization Source synchronization source - each source of RTP PDUs Identified by a unique,randomly chosen 32-bit ID (the SSRC) A host generating multiple streams within a single RTP must use a different SSRC perstream
How does Sequence number and Timestamp help ?Audio silence example: Consider audio data – What should the sender do during silence? Not send anything – Why might this cause problems? silence Receiver cannot distinguish between loss and silence Solution: – After receiving no PDUs for a while, next PDU received at the receiver will reflect a big jump in timestamp, but have the correct next seq. no. Thus, receiver knows what happened.
Real-Time Streaming Protocol (RTSP) Application layer protocol (default port 554) Usually runs on RTP for stream & TCP for control Provides the control channel Uses out-of-band signaling Usable for Live broadcasts / multicast Also known as “Network remote control” for multi-media servers.
RTSP Overview Web Server web HTTP presentation descriptor browser Presentation descriptor Web Server/Media server RTSP media pres. desc,streaming commands player RTP/RTCP audio/video content
RTSP Methods C SOPTIONS determine capabilities of server/client C SDESCRIBE C S get description of media streamANNOUNCE C S announce new session descriptionSETUP C S create media sessionRECORD C S start media recordingPLAY C S start media deliveryPAUSE C S pause media deliveryREDIRECT C S redirection to another serverTEARDOWN C S immediate teardownSET_PARAMETER C S change server/client parameterGET_PARAMETER C S read server/client parameter
RTSP Session Default port 554 RTSP SETUP RTSP OK RTSP RTSP PLAY server RTSP OK RTSP TCP client RTSP TEARDOWN RTSP OK get UDP port choose UDP port data RTP VIDEO source AV RTP AUDIO UDP subsystem RTCP media server media player
Example:Media on demand (Unicast) Media server A audio.example.com Media server V video.example.com Client C Web server W -holds the media descriptors
RTSP Message sequence C -> W : GET/Twister.sdp HTTP/1.1 Host: www.example.com Accept: application/sdp W-> C : HTTP/1.0 200 OK W Content-Type: application/sdpC-> A : SETUP rtsp://audio.example.com/twister/audio.en RTSP/1.0 V Cseq:1 Transport : RTP/AVP/UDP;unicast;client_port=3056-3057 CA-> C : RTSP/1.0 200 OK A Cseq:1 Session: 12345678 Transport : RTP/AVP/UDP;unicast;client_port=3056-3057 server_port=5000-5001C->V : SETUP rtsp://video.example.com/twister/video.en RTSP/1.0 Cseq:1 Transport : RTP/AVP/UDP;unicast;client_port=3058-3059A-> C : RTSP/1.0 200 OK Cseq:1 Session: 23456789 Transport : RTP/AVP/UDP;unicast;client_port=3058-3059 server_port=5002-5003
RTSP Message sequence (contd.) C->V: PLAY rtsp://video.example.com/twister/video RTSP/1.0 Cseq: 2 Session: 23456789 W V->C: RTSP/1.0 200 OK V Cseq: 2 Session: 23456789 RTP-Info: url=rtsp://video.example.com/twister/video; C seq=12312232; A C->A: PLAY rtsp://audio.example.com/twister/audio.en RTSP/1.0 Cseq: 2 Session: 12345678 A->C: RTSP/1.0 200 OK Cseq: 2 Session: 12345678 RTP-Info: url=rtsp://audio.example.com/twister/audio.en; seq=876655;
RTSP Message sequence (contd.)C->A: TEARDOWN rtsp://audio.example.com/twister/audio.en RTSP/1.0 Cseq: 3 Session: 12345678 W A->C: RTSP/1.0 200 OK Cseq: 3 VC->V: TEARDOWN rtsp://video.example.com/twister/video RTSP/1.0 C Cseq: 3 Session: 23456789 AV->C: RTSP/1.0 200 OK Cseq: 3
References  B. A. Forouzan, “TCP/IP Protocol Suite”, Third edition,  H. Schulzrinne, S. Casner, R. Frederick and V. Jacobson, "RTP: a transport protocol for real-time applications", RFC 3550, July 2003.  H. Schulzrinne, A. Rao and R. Lanphier, "Real Time Streaming Protocol (RTSP)", RFC 2326, April 1998.