810 likes | 1.15k Views
RTP. RTP. “Real-Time Transport Protocol” (not really a transport protocol) Provides source identification sequence number time stamping payload identification. RTP Packet Format. RTP Header. RTP Payload Header. RTP Payload. RTP Header. payload type : 7 bits
E N D
RTP • “Real-Time Transport Protocol” (not really a transport protocol) • Provides • source identification • sequence number • time stamping • payload identification
RTP Packet Format RTP Header RTP Payload Header RTP Payload
RTP Header • payload type: 7 bits • identify content (mp3? MPEG-1?)
RTP Header • sequence number: 16 bits • packet sequence number
RTP Header • media timestamp: 32 bits • the instant the first byte in this packet is captured
RTP Header • SSRC: 32 bits • random, unique in a session • identify a source (not host!)
RTP Header • marker bit: • depends on payload • e.g. beginning of frame
On Receiving RTP packet • check SSRC • new source? • existing source? which one? • check payload type • has format been changed? • which decoder should I use?
SSRC Attack! • Send gazillion packets, each with different SSRC • Remedy: • consider as new source only after K packets • soft-states related keywords from last lecture security robustness soft-states
RTCP • Real-Time Control Protocol • Provides • receiver’s feedback • network conditions • time synchronization • receiver’s description
RTCP Packet Types • Sender’s Report (SR) • Receiver’s Report (RR) • Source Description (SDES) • Application Specific (APP) • BYE
Fields in SR • NTP and RTP Timestamp • relate media timestamp to real time • Sender’s stats • byte count, packet count
Fields in SR + RR • Reception Report • Number of lost packets • % of lost packets • Inter-arrival jitter • Timestamp of last SR • Delay since last SR
Fields in SDES • Name, e-mail, phone, tool, location, notes etc. • CNAME: unique and constant in a session
Deducing Network Conditions • Packet Loss Rate • Interarrival Jitter • Round Trip Time
Calculating Packet Loss Ratio • for each source, keep • first sequence number S0 • last sequence number Slast • Expected packets = Slast – S0 • Count how many received packets
Calculating Interarrival Jitter • Variance in packet spacing • Define: • Pi.arrival_time • Pi.media_timestamp • Pi.transit_time
Calculating Interarrival Jitter • Pi.transit_time = Pi.arrival_time - Pi.media_timestamp • Difference in transit time for two consecutive packets = |Pi.transit_time – Pi-1.transit_time|
Calculating Interarrival Jitter • Jitter after packet i = Ji • Ji = (1-a) Ji-1 + a D(i,i-1)
Calculating RTT • T.lsr = • timestamp in last received SR • T.dlsr = • delay since last SR is received
Calculating RTT • RTT = Tcurr – Tlsr - Tdlsr Tlsr Tcurr S R Tdlsr
Calculating ??? • Pi.sender_byte_count • Pi.sender_packet_count
RTCP Scaling • B: Fix RTCP bandwidth • N: Number of participants • S: Mean RTCP packet size Sending interval = NS/B
Translators SSRC: 1000 PT: 32 SSRC: 1000 PT: 46
Mixers SSRC: 1000 PT: 32 TS: 4000 SSRC: 4654 PT: 32 CSRC: 1000 CSRC: 3388 TS: 8000 SSRC: 3388 PT: 32 TS: 4000
Example Translator Tunnel through Firewall
Example Translator 128Kbps 10Mbs
Good Exam Question • How should a translator/mixer process RTCP packets?
How to send/recv? Let the application decide, not protocol stacks. Tennenhouse + Clark
Application knows best. • How to reorder packets • How to ignore loss • How to retransmit
Application Data Unit (ADU) • can be processed individually • If 1 packet = 1 ADU then • each packet can be processed immediately
How to chop data into packets? • Every received packet should be useful (Even in very lossy environment)
Chopping MPEG into Packets • Try to fit a slice into one packet. • Try to make beginning of payload either the start of GOP or Picture or Slice
RTP Payload Header RTP Header RTP Payload Header RTP Payload • MPEG-1? 2? • Temporal Reference • I? P? B? • Begin of Slice? End of Slice?
Extensions to RTP • SRTP : Secure RTP • RTP Header Compression • Header Size: 40 bytes • Payload Size: 20ms, 8Kbps audio
Encoder Decoder Middlebox Receiver Sender Network You are Here
How to Send? open socket while not done read data add RTP header send
What’s Wrong? • Send more than network can handle • May cause TCP to reduce congestion window • No reaction to packet loss? • Are all packets equally important? • Burst of packets
Today’s Topic • How to adapt sending rate to network conditions
Idea • When the network is congested, reduce rate.
How to reduce rate? • Send slower
How to reduce rate? • Reduce encoding bit-rate • Increase quantization factor • Reduce frame resolution • Reduce frame rate