Lecture 9: Multimedia Transmission Protocol - PowerPoint PPT Presentation

Loading...

PPT – Lecture 9: Multimedia Transmission Protocol PowerPoint presentation | free to download - id: 60221c-YjkzZ



Loading


The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
About This Presentation
Title:

Lecture 9: Multimedia Transmission Protocol

Description:

Lecture 9: Multimedia Transmission Protocol Hongli Luo, CEIT * * * * * * * * * * * * * * * * * * * * * * * * * Example of SIP message INVITE sip:bob_at_domain.com SIP/2 ... – PowerPoint PPT presentation

Number of Views:86
Avg rating:3.0/5.0
Slides: 60
Provided by: DonT187
Learn more at: http://www.etcs.ipfw.edu
Category:

less

Write a Comment
User Comments (0)
Transcript and Presenter's Notes

Title: Lecture 9: Multimedia Transmission Protocol


1
Lecture 9 Multimedia Transmission Protocol
  • Hongli Luo, CEIT

2
Multimedia Transmission Protocol
  • RTSP
  • RTP
  • RTCP
  • SIP
  • Socket Programming

3
User Control of Streaming Media RTSP
  • HTTP
  • does not target multimedia content
  • no commands for fast forward, etc.
  • RTSP RFC 2326
  • Allow the media player and server to exchange
    playback control information
  • Allows a media player to control the transmission
    of a media stream
  • client-server application layer protocol
  • user control rewind, fast forward, pause,
    resume, repositioning, etc
  • What it doesnt do
  • doesnt define how audio/video is encapsulated
    for streaming over network
  • doesnt restrict how streamed media is
    transported (UDP or TCP possible)
  • doesnt specify how media player buffers
    audio/video

4
RTSP out of band control
  • RTSP messages also sent out-of-band
  • RTSP control messages use different port numbers
    than media stream out-of-band.
  • port 554
  • Over TCP or UDP
  • media stream is considered in-band.
  • Adopted by RealNetworks
  • FTP uses an out-of-band control channel
  • file transferred over one TCP connection.
  • control info (directory changes, file deletion,
    rename) sent over separate TCP connection
  • out-of-band, in-band channels use different
    port numbers

5
FTP the file transfer protocol
file transfer
user at host
remote file system
local file system
  • transfer file to/from remote host
  • client/server model
  • client side that initiates transfer (either
    to/from remote)
  • server remote host
  • ftp RFC 959
  • ftp server port 21

6
FTP separate control, data connections
  • FTP client contacts FTP server at port 21, TCP is
    transport protocol
  • client authorized over control connection
  • client browses remote directory by sending
    commands over control connection.
  • when server receives file transfer command,
    server opens 2nd TCP connection (for file) to
    client
  • after transferring one file, server closes data
    connection.
  • server opens another TCP data connection to
    transfer another file.
  • The control session remains open throughout the
    duration of the user session
  • control connection out of band
  • FTP server maintains state current directory,
    earlier authentication

7
RTSP Example
  • Scenario
  • metafile communicated to web browser
  • browser launches player
  • player sets up an RTSP control connection, data
    connection to streaming server

8
Metafile Example
  • lttitlegtTwisterlt/titlegt
  • ltsessiongt
  • ltgroup languageen lipsyncgt
  • ltswitchgt
  • lttrack typeaudio
  • e"PCMU/8000/1"
  • src
    "rtsp//audio.example.com/twister/audio.en/lofi"gt
  • lttrack typeaudio
  • e"DVI4/16000/2"
    pt"90 DVI4/8000/1"
  • src"rtsp//audio.ex
    ample.com/twister/audio.en/hifi"gt
  • lt/switchgt
  • lttrack type"video/jpeg"
  • src"rtsp//video.ex
    ample.com/twister/video"gt
  • lt/groupgt
  • lt/sessiongt

9
RTSP Operation
10
RTSP Exchange Example
  • C SETUP rtsp//audio.example.com/twister/audi
    o RTSP/1.0
  • Transport rtp/udp compression
    port3056 modePLAY
  • S RTSP/1.0 200 1 OK
  • Session 4231
  • C PLAY rtsp//audio.example.com/twister/audio
    .en/lofi RTSP/1.0
  • Session 4231
  • Range npt0-
  • S RTSP/1.0 200 2 OK
  • Session 4231
  • C PAUSE rtsp//audio.example.com/twister/audi
    o.en/lofi RTSP/1.0
  • Session 4231
  • Range npt37
  • S RTSP/1.0 200 3 OK
  • Session 4231
  • C TEARDOWN rtsp//audio.example.com/twister/a
    udio.en/lofi RTSP/1.0
  • Session 4231

11
Real-Time Protocol (RTP)
  • RTP specifies packet structure for packets
    carrying audio, video data
  • Audio PCM, GSM, MP3
  • Video MPEG and h.263
  • Proprietary audio and video formats
  • RTP packet provides
  • payload type identification
  • packet sequence numbering
  • time stamping
  • RFC 3550
  • RTP runs in end systems
  • RTP packets encapsulated in UDP segments
  • interoperability if two Internet phone
    applications run RTP, then they may be able to
    work together

12
RTP runs on top of UDP
  • RTP libraries provide transport-layer interface
  • that extends UDP
  • port numbers, IP addresses
  • payload type identification
  • packet sequence numbering
  • time-stamping

13
RTP Example
  • consider sending 64 kbps PCM-encoded voice over
    RTP.
  • application collects encoded data in chunks,
    e.g., every 20 msec 160 bytes in a chunk.
  • audio chunk RTP header form RTP packet, which
    is encapsulated in UDP segment
  • RTP header indicates type of audio encoding in
    each packet
  • sender can change encoding during conference.
  • RTP header also contains sequence numbers,
    timestamps.

14
RTP and QoS
  • RTP does not provide any mechanism to ensure
    timely data delivery or other QoS guarantees.
  • RTP does not provide
  • Timely delivery of data
  • QoS guarantees
  • Guarantee delivery of packets
  • Prevention of out-of-order delivery of packets
  • RTP encapsulation is only seen at end systems
    (not) by intermediate routers.
  • routers providing best-effort service, making no
    special effort to ensure that RTP packets arrive
    at destination in timely matter.

15
RTP Header (12 bytes)
  • Payload Type (7 bits) Indicates type of encoding
    currently being used. If sender changes encoding
    in middle of conference, sender
  • informs receiver via payload type field.
  • Payload type 0 PCM mu-law, 64 kbps
  • Payload type 3, GSM, 13 kbps
  • Payload type 7, LPC, 2.4 kbps
  • Payload type 26, Motion JPEG
  • Payload type 31. H.261
  • Payload type 33, MPEG2 video
  • Sequence Number (16 bits) Increments by one for
    each RTP packet
  • sent, and may be used to detect packet loss and
    to restore packet
  • sequence.

16
RTP Header (2)
  • Timestamp field (32 bytes long) sampling instant
    of first byte in this RTP data packet
  • Receiver can use it to remove packet jitter and
    to provide synchronous playout
  • for audio, timestamp clock typically increments
    by one for each sampling period (for example,
    each 125 usecs for 8 KHz sampling clock)
  • if application generates chunks of 160 encoded
    samples, then timestamp increases by 160 for each
    RTP packet when source is active. Timestamp clock
    continues to increase at constant rate when
    source is inactive.
  • SSRC field (32 bits long) identifies source of
    RTP stream. Each stream in RTP session should
    have distinct SSRC.
  • Miscellaneous fields (9 bits)

17
Developing Software Applications with RTP
  • Two approaches to develop an RTP-based networked
    applications
  • Incorporate RTP by hand
  • write the code that performs RTP encapsulation at
    the sender side and RTP decapsulation at the
    client side
  • Use existing RTP libraries (for C programmers)
    and Java classes (for Java programmers)
  • The libraries and classes perform the
    encapsulation and decapsulation for the
    application

18
Incorporate RTP by hand - example
  • A server that encapsulates stored video frames
    into RTP packets
  • grab video frame,
  • add RTP headers to frame and generate an RTP
    packet
  • create UDP segments, send segments to UDP socket
  • include seq numbers and time stamps
  • The API is the standard UDP socket API
  • A client decapsulates the RTP packet and display
    the video frame
  • RTSP
  • Client issue setup/play/pause/teardown commands
  • Server accepts the requests and take actions

19
  • RTP does not mandate a specific port number.
  • The application developer specifies the port
    number for the two sides of the application.

20
  • Use existing Java RTP class to implement (or C
    RTP library for C programmers) to implement the
    RTP.
  • The sender application provides
  • media chunk, payload-type number, SSRC,
    timestamp, destination port number, destination
    IP
  • Java Media Framework (JMF) includes a complete
    RTP implementation

21
Real-Time Control Protocol (RTCP)
  • each RTCP packet contains sender and/or receiver
    reports
  • report statistics useful to application
    packets sent, packets lost, interarrival
    jitter, etc.
  • feedback can be used to control performance
  • sender may modify its transmissions based on
    feedback
  • works in conjunction with RTP.
  • each participant in RTP session periodically
    transmits RTCP control packets to all other
    participants.

22
RTCP - Continued
  • each RTP session typically a single multicast
    address all RTP /RTCP packets belonging to
    session use multicast address.
  • RTP, RTCP packets distinguished from each other
    via distinct port numbers.
  • RTCP port number is set to be equal to the RTP
    port number plus one
  • to limit traffic, each participant reduces RTCP
    traffic as number of conference participants
    increases

23
RTCP Packets
  • Receiver report packets
  • Receiver aggregates its reception report into a
    single RTCP packet
  • The packet is sent into the multicast tree that
    connects all the sessions participants.
  • Fields in reception report
  • SSRC of RTP stream
  • fraction of packets lost the sender can switch
    to different encoding rates
  • last sequence number
  • average interarrival jitter a smoothed estimate
    of the variation in the interarrival time between
    successive packets in the RTP stream

24
RTCP Packets
  • Sender report packets
  • Sender creates and transmits RTCP sender report
    packets
  • The packets include information such as
  • SSRC of RTP stream,
  • Time stamp, wall clock time (current time) of the
    most recently generated RTP packet in the stream
  • number of packets sent,
  • number of bytes sent
  • Sender reports can be used to synchronize
    different media streams within a RTP session.

25
RTCP Packets
  • Source description packets
  • Sender also creates and transmits source
    description packets.
  • Includes e-mail address of sender, sender's name,
    SSRC of associated RTP stream, application that
    generates the RTP stream
  • provide mapping between the SSRC and the
    user/host name
  • RTCP packets are stackable
  • Receiver reception reports, sender reports, and
    source descriptors can be concatenated into a
    single packet
  • The RTCP packet is then encapsulated into a UDP
    segment

26
Synchronization of Streams
  • RTCP can synchronize different media streams
    within a RTP session
  • consider videoconferencing app for which each
    sender generates one RTP stream for video, one
    for audio.
  • timestamps in RTP packets tied to the video,
    audio sampling clocks
  • not tied to wall-clock time (real time)
  • each RTCP sender-report packet contains (for most
    recently generated packet in associated RTP
    stream)
  • timestamp of RTP packet
  • wall-clock time for when packet was created.
  • receivers uses association to synchronize playout
    of audio, video

27
RTCP Bandwidth Scaling
  • RTCP attempts to limit its traffic to 5 of
    session bandwidth.
  • Example
  • Suppose one sender, sending video at 2 Mbps. Then
    RTCP attempts to limit its traffic to 100 Kbps.
  • RTCP gives 75 of rate to receivers remaining
    25 to sender
  • 75 kbps is equally shared among receivers
  • with R receivers, each receiver gets to send
    RTCP traffic at 75/R kbps.
  • sender gets to send RTCP traffic at 25 kbps.
  • participant determines RTCP packet transmission
    period by calculating avg RTCP packet size
    (across entire session) and dividing by
    allocated rate

28
RTCP Bandwidth Scaling (2)
  • The period for transmitting RTCP packets for a
    sender is
  • T (number of senders ) (avg. RTCP packet
    size)
  • / (.25 .05 session bandwidth)
  • The period for transmitting RTCP packets for a
    receiver is
  • T (number of senders ) (avg. RTCP packet size)
  • / (.75 .05 session bandwidth)

29
SIP Session Initiation Protocol RFC 3261
  • SIP long-term vision
  • all telephone calls, video conference calls take
    place over Internet
  • people are identified by names or e-mail
    addresses, rather than by phone numbers
  • you can reach callee, no matter where callee
    roams, no matter what IP device callee is
    currently using computer or PDA

30
SIP Services
  • Setting up a call between caller and callee, SIP
    provides mechanisms ..
  • for caller to let callee know she wants to
    establish a call
  • so caller, callee can agree on media type,
    encoding
  • to end call
  • determine current IP address of callee
  • Callee has dynamic IP by DHCP or has multiple IP
    devices
  • maps mnemonic identifier to current IP address
  • call management
  • add new media streams during call
  • change encoding during call
  • invite others
  • transfer, hold calls

31
Setting up a call to known IP address
  • Alices SIP invite message indicates her port
    number, IP address, encoding she prefers to
    receive (PCM ulaw)
  • Bobs 200 OK message indicates his port number,
    IP address, preferred encoding (GSM)
  • SIP messages can be sent over TCP or UDP here
    sent over RTP/UDP.
  • default SIP port number is 5060.

32
Setting up a call (more)
  • SIP is an out-of-band protocol
  • SIP messages are sent and received in sockets
    different from those for media data
  • SIP messages are ASCII-readable and resemble HTTP
    messages
  • SIP requires all messages to be acknowledged
  • It can run over UDP or TCP
  • media can be sent over RTP or some other protocol
  • codec negotiation
  • suppose Bob doesnt have PCM ulaw encoder.
  • Bob will instead reply with 606 Not Acceptable
    Reply, listing his encoders Alice can then send
    new INVITE message, advertising different encoder
  • rejecting a call
  • Bob can reject with replies busy, gone,
    payment required, forbidden

33
SIP Addresses
  • Bobs SIP address is sipbob_at_193.64.210.89
  • When Alices SIP device sends an INVITE message,
    the message would include this email-like address
  • The SIP infrastructure would then route the
    message to the IP advice that Bob is currently
    using
  • Other possible forms for SIP address
  • Phone number
  • First/last name
  • SIP address can be included in Web page

34
Example of SIP message
  • INVITE sipbob_at_domain.com SIP/2.0
  • Via SIP/2.0/UDP 167.180.112.24
  • From sipalice_at_hereway.com
  • To sipbob_at_domain.com
  • Call-ID a2e3a_at_pigeon.hereway.com
  • Content-Type application/sdp
  • Content-Length 885
  • cIN IP4 167.180.112.24
  • maudio 38060 RTP/AVP 0
  • Notes
  • HTTP message syntax
  • sdp session description protocol
  • Call-ID is unique for every call.
  • Here we dont know
  • Bobs IP address.
  • Intermediate SIP servers needed.
  • Alice sends, receives SIP messages using SIP
    default port 506
  • Alice specifies in Via IP address of the
    device, header that SIP client sends, receives
    SIP messages over UDP

35
Name translation and user locataion
  • caller wants to call callee, but only has
    callees name or e-mail address.
  • need to get IP address of callees current host
  • user moves around
  • DHCP protocol
  • user has different IP devices (PC, PDA, car
    device)
  • result can be based on
  • time of day (work, home)
  • caller (dont want boss to call you at home)
  • status of callee (calls sent to voicemail when
    callee is already talking to someone)
  • Service provided by SIP servers
  • SIP proxy server
  • SIP registrar server

36
SIP Proxy
  • Alice sends invite message to her proxy server
  • contains address sipbob_at_domain.com
  • proxy responsible for routing SIP messages to
    callee
  • possibly through multiple proxies.
  • callee sends response back through the same set
    of proxies.
  • proxy returns SIP response message to Alice
  • contains Bobs IP address
  • proxy analogous to local DNS server

37
SIP Registrar
  • when Bob starts SIP client, client sends SIP
    REGISTER message to Bobs registrar server
  • (similar function needed by Instant
    Messaging)
  • Often SIP registrars and SIP proxies are run on
    the same host

Register Message
  • REGISTER sipdomain.com SIP/2.0
  • Via SIP/2.0/UDP 193.64.210.89
  • From sipbob_at_domain.com
  • To sipbob_at_domain.com
  • Expires 3600

38
Example
Caller jim_at_umass.edu with places a call to
keith_at_upenn.edu (1) Jim sends INVITE message to
umass SIP proxy. (2) Proxy forwards request to
upenn registrar server. (3) upenn server
returns redirect response, indicating that it
should try keith_at_eurecom.fr
(4) umass proxy sends INVITE to eurecom
registrar. (5) eurecom registrar forwards INVITE
to 197.87.54.21, which is running keiths SIP
client. (6-8) SIP response sent back (9) media
sent directly between clients. Note also a SIP
ack message, which is not shown.
39
Comparison with H.323
  • H.323 is another signaling protocol for
    real-time, interactive audio and video
    conferencing
  • H.323 is a complete, vertically integrated suite
    of protocols for multimedia conferencing
    signaling, registration, admission control,
    transport, codecs
  • SIP is a single component. Works with RTP, but
    does not mandate it. Can be combined with other
    protocols, services
  • H.323 comes from the ITU (telephony).
  • SIP comes from IETF Borrows much of its concepts
    from HTTP
  • SIP has Web flavor, whereas H.323 has telephony
    flavor.
  • SIP uses the KISS principle Keep it simple
    stupid.

40
(No Transcript)
41
Socket programming
  • Development of network applications
  • Implementation of protocol standard defined in an
    RFC
  • Client and server conform to the rules of RFC
  • Use the port number associated with the protocol
  • Allows interoperability
  • Proprietary network application
  • The application-layer protocol used by the client
    and the server do not necessarily conform to any
    existing RFC
  • Developer creates both client and server programs
  • Not interoperable with other applications
  • Not to use well-known port numbers defined in
    RFCs
  • TCP or UDP at the transport layer?

42
Socket programming
Goal learn how to build client/server
application that communicate using sockets
  • Socket API
  • introduced in BSD4.1 UNIX, 1981
  • explicitly created, used, released by apps
  • client/server paradigm
  • two types of transport service via socket API
  • unreliable datagram
  • reliable, byte stream-oriented

43
Socket-programming using TCP
  • Socket a door between application process and
    end-end-transport protocol (UCP or TCP)
  • TCP service reliable transfer of bytes from one
    process to another

controlled by application developer
controlled by application developer
controlled by operating system
controlled by operating system
internet
host or server
host or server
44
Socket programming with TCP
  • Client must contact server
  • server process must first be running
  • server must have created socket (door) that
    welcomes clients contact
  • Client contacts server by
  • creating client-local TCP socket
  • specifying IP address, port number of server
    process
  • The client choses a source port number
  • When client creates socket client TCP
    establishes connection to server TCP
  • When contacted by client, server TCP creates new
    socket for server process to communicate with
    client
  • allows server to talk with multiple clients
  • source port numbers used to distinguish clients
  • TCP socket is identified by a four-tuple (source
    IP address, source port number, destination IP
    address, destination port number)

45
Client/server socket interaction TCP
Server (running on hostid)
Client
46
Stream jargon
  • A stream is a sequence of characters that flow
    into or out of a process.
  • An input stream is attached to some input source
    for the process, e.g., keyboard or socket.
  • An output stream is attached to an output source,
    e.g., monitor or socket.

Client process
client TCP socket
47
Socket programming with TCP
  • Example client-server app
  • 1) client reads line from standard input
    (inFromUser stream) , sends to server via socket
    (outToServer stream)
  • 2) server reads line from socket
  • 3) server converts line to uppercase, sends back
    to client
  • 4) client reads, prints modified line from
    socket (inFromServer stream)

48
Example Java client (TCP)
import java.io. import java.net. class
TCPClient public static void main(String
argv) throws Exception String
sentence String modifiedSentence
BufferedReader inFromUser new
BufferedReader(new InputStreamReader(System.in))
Socket clientSocket new
Socket("hostname", 6789)
System.out.println(client port "
clientSocket.getLocalPort())
DataOutputStream outToServer new
DataOutputStream(clientSocket.getOutputStream())

Create input stream
Create client socket, connect to server
Create output stream attached to socket
49
Example Java client (TCP), cont.
Create input stream attached to socket
BufferedReader inFromServer
new BufferedReader(new
InputStreamReader(clientSocket.getInputStream()))
sentence inFromUser.readLine()
outToServer.writeBytes(sentence '\n')
modifiedSentence inFromServer.readLine()
System.out.println("FROM SERVER "
modifiedSentence) clientSocket.close()

Send line to server
Read line from server
50
Example Java server (TCP)
import java.io. import java.net. class
TCPServer public static void main(String
argv) throws Exception String
clientSentence String capitalizedSentence
ServerSocket welcomeSocket new
ServerSocket(6789) while(true)
Socket connectionSocket
welcomeSocket.accept()
BufferedReader inFromClient new
BufferedReader(new
InputStreamReader(connectionSocket.getInputStream(
)))
Create welcoming socket at port 6789
Wait, on welcoming socket for contact by client
Create input stream, attached to socket
51
Example Java server (TCP), cont
DataOutputStream outToClient
new DataOutputStream(connectionSocket.get
OutputStream()) clientSentence
inFromClient.readLine()
capitalizedSentence clientSentence.toUpperCase()
'\n' outToClient.writeBytes(capit
alizedSentence)
Create output stream, attached to socket
Read in line from socket
Write out line to socket
End of while loop, loop back and wait for another
client connection
52
(No Transcript)
53
Socket programming with UDP
  • UDP no connection between client and server
  • no handshaking
  • sender explicitly attaches IP address and port of
    destination to each packet
  • server must extract IP address, port of sender
    from received packet
  • UDP transmitted data may be received out of
    order, or lost

54
Client/server socket interaction UDP
Server (running on hostid)
55
Example Java client (UDP)
Client process
Input receives packet (recall thatTCP received
byte stream)
Output sends packet (recall that TCP sent byte
stream)
client UDP socket
56
Example Java client (UDP)
import java.io. import java.net. class
UDPClient public static void main(String
args) throws Exception
BufferedReader inFromUser new
BufferedReader(new InputStreamReader(System.in))
DatagramSocket clientSocket new
DatagramSocket() InetAddress IPAddress
InetAddress.getByName("hostname")
byte sendData new byte1024 byte
receiveData new byte1024 String
sentence inFromUser.readLine() sendData
sentence.getBytes()
Create input stream
Create client socket
Translate hostname to IP address using DNS
57
Example Java client (UDP), cont.
Create datagram with data-to-send, length, IP
addr, port
DatagramPacket sendPacket new
DatagramPacket(sendData, sendData.length,
IPAddress, 9876) clientSocket.send(send
Packet) DatagramPacket receivePacket
new DatagramPacket(receiveData,
receiveData.length) clientSocket.receiv
e(receivePacket) String
modifiedSentence new
String(receivePacket.getData())
System.out.println("FROM SERVER"
modifiedSentence) clientSocket.close()

Send datagram to server
Read datagram from server
58
Example Java server (UDP)
import java.io. import java.net. class
UDPServer public static void main(String
args) throws Exception
DatagramSocket serverSocket new
DatagramSocket(9876) byte
receiveData new byte1024 byte
sendData new byte1024 while(true)
DatagramPacket
receivePacket new
DatagramPacket(receiveData, receiveData.length)
serverSocket.receive(receivePacket)
Create datagram socket at port 9876
Create space for received datagram
Receive datagram
59
Example Java server (UDP), cont
String sentence new
String(receivePacket.getData())
InetAddress IPAddress receivePacket.getAddress()
int port receivePacket.getPort()
String
capitalizedSentence sentence.toUpperCase()
sendData capitalizedSentence.getBytes()
DatagramPacket sendPacket
new DatagramPacket(sendData,
sendData.length, IPAddress,
port) serverSocket.send(s
endPacket)
Get IP addr port , of sender
Create datagram to send to client
Write out datagram to socket
End of while loop, loop back and wait for another
datagram
About PowerShow.com