220 likes | 571 Views
Real Time Streaming Protocol. Akshat Sikarwar Columbia University November 12, 2008. Overview. Introduction Protocol properties RTSP messages Important messages. Introduction. RTSP is like a network remote control for multimedia servers
E N D
Real Time Streaming Protocol Akshat Sikarwar Columbia University November 12, 2008
Overview • Introduction • Protocol properties • RTSP messages • Important messages
Introduction • RTSP is like a network remote control for multimedia servers • RTSP establishes and controls streams of continuous media • Streaming data is carried out of band (interleaving is possible)
Protocol Properties • RTSP is text based and HTTP like • Transport independent (can use UDP or TCP) • Unlike HTTP commands can be sent in either direction • RTSP is a stateful protocol. Server maintains session state.
RTSP Connections • RTSP messages can be sent over: • One persistent transport connection for several request-response transactions • One connection per transaction • Connectionless mode • Transport connection != Session • Server can send message to client only in persistent connection
RTSP Reliability • If using reliable transport message is sent just once. • If using unreliable transport, RTSP will retransmit if it does not receive ACK • Timeout is initially set to 500 ms • Can re-compute timeout based on RTT like TCP • For retransmission CSeq is not incremented • Timestamp is used to overcome retransmission ambiguity problem
RTSP URI rtsp://media.example.com:554/twister/audio • rtspidentifies reliable protocol • rtspuidentifies unreliable protocol • Default port is 554 • Presentation: twister • Stream: audio
RTSP Message • Text based messages • Messages use Unicode (ISO 10646) character set encoded using UTF-8 • Lines are terminated by CRLF • Messages can be request or response by either client or server • Message structure is HTTP like
Request Message Method URI Version CRLF Header1:Value CRLF Header2:Value CRLF CRLF Body • First line is Request line • URI is always absolute (unlike HTTP) • URI can be * • Example OPTIONS * RTSP/1.0
Response Message Version Status-Code Reason-Phrase CRLF • Status-Codes are HTTP like • 1xx: Informational • 2xx: Success • 3xx: Redirection • 4xx: Client error • 5xx: Server error • Reason-Phrase is the textual description
RTSP at Work HTTP GET Client Web server Session description Media server PLAY RTP RTCP PAUSE CLOSE From http://www.cs.columbia.edu/~hgs/teaching/ais/slides/2003/RTSP.pdf
RTSP Methods • DESCRIBE Get (low level) description of media object • OPTIONS Get available methods • SETUP Establish transport • PLAY Start playback, reposition • PAUSE Halt delivery, but keep state • RECORD Start recording • ANNOUNCE Change description of media object • REDIRECT Redirect client to new server • GET_PARAMETER Retrieves presentation parameter value • SET_PARAMETER Sets presentation parameter value • TEARDOWN Remove state From http://www.cs.columbia.edu/~hgs/teaching/ais/slides/2003/RTSP.pdf
Method Summary From RFC 2326
Messages in Action Following messages play central role: • SETUP • PLAY • PAUSE • TEARDOWN
SETUP • Specifies the transport mechanism to be used for the streamed media • Transport header specifies the transport parameters acceptable to the client • Response contains transport parameters selected by the server • Server generates session identifiers in response to SETUP requests • Client can issue SETUP to change parameters for already streaming media
SETUP Message Client -> Server: SETUP rtsp://example.com/foo/bar/baz.rm RTSP/1.0 CSeq: 302 Transport: RTP/AVP;unicast;client_port=4588-4589 Server -> Client: RTSP/1.0 200 OK Cseq: 302 Date: 23 Jan 1997 15:35:06 GMT Session: 47112344 Transport: RTP/AVP;unicast; client_port=4588-4589;server_port=6256-6257 From RFC 2326
PLAY • Tells server to start sending data via mechanism specified in SETUP • Plays from beginning to end of range specified • Pauses at end as if PAUSE has been issued • Requests may be pipelined • Range header can have time parameter • Legal to have PLAY without Range header • Scale header can be used to change viewing rate • Can be used for fast forward or rewind
PLAY Message Client -> Server: PLAY rtsp://audio.example.com/twister.en RTSP/1.0 CSeq: 833 Session: 12345678 Range: smpte=0:10:20-;time=19970123T153600Z Server -> Client: RTSP/1.0 200 OK CSeq: 833 Date: 23 Jan 1997 15:35:06 GMT Range: smpte=0:10:22-;time=19970123T153600Z From RFC 2326
PAUSE • Causes stream delivery to halt • Can pause entire presentation or selected stream • Server resources continue to be reserved • Server will terminate session after timeout period expires (specified in SETUP) • Can contain Range header with one value to specify when to pause • Must fall in one of the PLAY ranges
TEARDOWN • Stops delivery of stream • Frees up resources on the server • Can stop single stream or entire presentation • Example Client -> Server: TEARDOWN rtsp://example.com/fizzle/foo RTSP/1.0 CSeq: 892 Session: 12345678 Server -> Client: RTSP/1.0 200 OK CSeq: 892
References • RFC 2326 • Internet Media on Demand : The Real Time Streaming Protocol: http://www.cs.columbia.edu/~hgs/teaching/ais/slides/2003/RTSP.pdf • RTSP: FAQ http://www.cs.columbia.edu/~hgs/rtsp/faq.html