Transfer and Control Protocols Standards of ITU H.261
Transcrição
Transfer and Control Protocols Standards of ITU H.261
Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Transfer and Control Protocols Chapter 2: Basics Chapter 3: Multimedia Systems – Communication Aspects and Services • Multimedia Applications and Communication • Multimedia Transfer and Control Protocols • Quality of Service and Resource Management 3.2: Transfer and Control Protocols • Synchronization • The H.x Protocols • Multimedia Operating Systems • Session Initiation Protocol SIP Chapter 4: Multimedia Systems • Streaming Multimedia Data – Storage Aspects • Transport Protocols: RTP and Chapter 5: Multimedia Usage RTCP • VoIP Example Page 1 Chapter 3.2: Transfer and Control Protocols A main protocol family is the H.x standards by the ITU • H.261 and H.263 define video coding for video conferences, similar to MPEG • H.323 is a control protocol for cooperative computing (session management) • Developed by ITU, driven by telecommunication needs Alternative for session management: Session Initiation Protocol (SIP) • Only one protocol, not a protocol family • Developed by IETF: integrated with the Internet Additionally: RTP/RTCP as transfer protocols • H.x and SIP both are not defining transport subsystems • RTP as an addition to UDP Chapter 3.2: Transfer and Control Protocols Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Standards of ITU The ITU has standardized everything needed in cooperative computing: • G.711, G.722, G.723, G.728, G.729 for audio coding with 5.3 – 64 kbit/s • H.261, H.263, H.264, … for video coding similar to MPEG • H.245 for controlling media streams • H.450 for negotiation of communication resources • H.235 for authentication and ciphering • H.225.0 for connection setup and termination, packetizing of data streams, signaling, … • H.323 for controlling and coordination • … and several more, e.g. T.x for data transfer Chapter 3.2: Transfer and Control Protocols Page 2 H.261 User Interface Audio Video Audio Codecs G.711 G.722 … Video Codecs H.261 H.263 … Configuration H.245 H.450 H.235 For video conferencing systems, coding/decoding in real-time is required • H.261 was designed for ISDN • It is a video codec for audiovisual services at p·64 Kbit/s (p = 1, 2, 3, ..., 30, referring to ISDN) → H.261 can be denoted as “px64” • Real-time processing requirement of encoding and decoding considered in this standard: maximum signal delay ≤ 150 ms (this requirement is a kind of limitation concerning coding and decoding procedures) H.323 H.225.0 Layer Network Interface Page 3 Chapter 3.2: Transfer and Control Protocols Page 4 Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Properties of H.261 Image Preparation • Image is subdivided into blocks of size 8 lines × 8 pixels (luminance & chrominance) • Macro blocks consists of 4 luminance blocks and 2 corresponding chrominance blocks • Group of blocks (GOB) = combination of 33 macro blocks → QCIF image consists of 3 GOBs (= 3 × 33 × 4 × 8 × 8 = 144 × 176 pixels for luminance), CIF image of 12 GOBs (= 12 × 33 × 4 × 8 × 8 = 288 × 352 pixels for luminance) • Note: color difference samples placed such that their block boundaries coincide with luminance block boundaries: • Image format precisely defined • Image refresh frequency at input: 29.97 frames/sec • Image encoded as luminance signal Y and chrominance difference signals CB, CR (according to a 4:1:1 subsampling scheme, later adopted by MPEG) → 3 basic information from which the full color may be constructed • 2 resolution formats (each with 4:3 aspect ratio): Common Intermediate Format (CIF) • luminance 288 lines × 352 pixels (8 bit per pixel) • chrominance 144 × 176 Quarter-CIF (QCIF) • luminance 144 × 176 • chrominance 72 × 88 QCIF is mandatory for all H.261 implementations, CIF is optional Luminance sample Chrominance sample Block edge Block Chapter 3.2: Transfer and Control Protocols Page 5 Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Page 6 Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Data Amount Interframe Coding Uncompressed QCIF: • Data rate = 29.97 frames/sec × (144 × 176 + 2 × 72 × 88) bytes/frame ≈ 9.115 Mbit/sec Uncompressed CIF: • Data rate ≈ 36.45 Mbit/sec (= 4 × 9.115 Mbit/sec) Compressed QCIF: • Needs only 10 frames per second (instead of 29.97 frames/sec), i.e. three times less: 3.041 Mbit/sec are required → Compression ratio in order to transmit 3.041 uncompressed Mbit/sec via a 64 Kbit/sec line: 64/3.041 ≈ 1 : 47.5 This is possible for today's technology, but only for slow moving pictures • Compressed CIF would need 4 - 6 ISDN B-channels for the same purpose • Coding Algorithms: 2 different methods of coding (choice up to the coding control strategy): Intraframe coding: like in JPEG with DCT, quantization and entropy encoding Interframe coding: use of information from previous frame (P frames in MPEG) Chapter 3.2: Transfer and Control Protocols Chapter 3.2: Transfer and Control Protocols Page 7 Prediction for each macro block by motion compensation and spatial filter • Motion compensation (similar to MPEG): Comparison of macro blocks from previous and current image → motion vector defined by relative position of previous and current macro block One motion vector per macro block, used for all luminance and chrominance blocks • Simple implementations just compare previous and actual macro blocks at the same position. In such case, the motion vector is a zero vector • Optionally (but rarely used) a low pass filter between DCT and entropy encoding can be used for deleting any remaining high-frequency noise • Linear quantization (step size adjusted according to data amount in transformation buffer) Constant data rate at encoder output enforced Quality of encoded video data depends on image contents and motion within scene Chapter 3.2: Transfer and Control Protocols Page 8 Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Data Streams in H.261 H.263 and H.264 Characteristics of Data Stream for H.261: • Data stream produced by H.261 has a hierarchical structure → several layers, like in MPEG (bottom layer containing compressed picture) • Data stream includes information for error correction (18 parity bits for 492 data bits) • 5-bit image number as temporal reference for each image • Freezing of image which was shown last is possible by an application command; this allows the application at the decoding station to stop and start a video scene in a convenient way • Switching between still images and moving images possible (by encoder command!) H.263 is similar to H.261, but… • … defines 5 image formats (sub-QCIF, QCIF, CIF, 4CIF, 16CIF) • … error correction is optional • … consideration of GOBs and Slices like in MPEG H.264 additionally … • … allows variable block size (16×16, 8×16, 16×8, 8×8) • … uses a very simple 4×4 transform instead of DCT (astonishingly with negligible loss in quality!) • … allows to use any frame as a reference for prediction • … also allows bi-directional prediction (B-frames) • … allows mixed frames – slices of one frame can be coded independently as I-slices, Pslices and B-slices! Conclusion: • Suited for applications which do not require too much quality and where the content doesn‘t move too fast (video conferencing) Chapter 3.2: Transfer and Control Protocols Page 9 Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme H.323 The ITU Family and the OSI Reference Model APPLICATION A video conference is not only transferring video… • Audio transmission (G.7xx), synchronization with video stream • Exchange of configuration data, signalling (H.225, H.245) • Whiteboard, chat, application sharing, data, fax … (T.x) • Transport subsystem (TCP, UDP, RTP, RTCP) • … → H.323 for coordination G.711 Video Signal G.728 H.261 H.263 G.722 G.729 Audio Signal G.723.1 Data T.127 T.126 PRESENTATION SESSION T.124 H.323 RTCP RAS RTP TRANSPORT Not only client terminals (telephones, video phones, NetMeeting, …) “speak” H.323, but also other system components: • Gatekeeper: address translation (phone numbers to IP addresses), admission control and bandwidth management for multipoint connections, call authorization, call signal routing • Gateway: integration with other voice networks • Multipoint control unit (MCU): coordinates several terminals taking part in a conference • Proxy: e.g. used to pass a firewall Chapter 3.2: Transfer and Control Protocols Page 10 Chapter 3.2: Transfer and Control Protocols T.125/ T.122 Supplementary Services H.450.3 H.235 • Transfer of multimedia data uses UDP, transfer of control information uses TCP • H.323 is an “umbrella” standard comprising all the other functionality H.450.2 H.450.1 X.224.0 Control UDP H.245 H.225 TCP NETWORK DATA LINK PHYSICAL Page 11 Chapter 3.2: Transfer and Control Protocols Page 12 Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme H.323 Network Components H.323 Components and Signaling H.225/RAS messages H.225/RAS messages H.225/Q.931 (optional) H.225/Q.931 (optional) Gatekeeper H.245 messages (optional) H.245 messages (optional) H.225/Q.931 messages over call signaling channel Terminal • H.323 terminal can be workstations as well as more specalized end systems, e.g. IP phones • The gateway enables an integration with existing systems like ISDN or older POTS (Plain Old Telephony System) Chapter 3.2: Transfer and Control Protocols Page 13 Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Gateway • H.245 – A protocol for capabilities advertisement, media channel establishment and conference control. • H.225 - Call Control • Q.931 – A protocol for call control and call setup. • RAS – Registration, admission and status protocol used for communicating between an H.323 endpoint and a gatekeeper. Page 14 Chapter 3.2: Transfer and Control Protocols Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Process for Establishing Communication Simplified H.323 Call Setup Establishing communication using H.323 occurs in five steps: 1. Call setup 2. Initial communication and capabilities exchange 3. Audio/video communication establishment 4. Call services 5. Call termination Chapter 3.2: Transfer and Control Protocols POTS H.245 messages over call control channel Page 15 • Both endpoints have previously registered with the gatekeeper • Terminal A initiate the call to the gatekeeper • The gatekeeper provides information for Terminal A to contact Terminal B • Terminal A sends a SETUP message to Terminal B • Terminal B responds with a Call Proceeding message and also contacts the gatekeeper for permission • Terminal B sends a Alerting and Connect message • Terminal B and A exchange H.245 messages to determine master/slave, terminal capabilities, and open logical channels • The two terminals establish RTP media paths3.2: for Transfer data transmission Chapter and Control Protocols Terminal A Gatekeeper Terminal B 1. ARQ 2. ACF 3. SETUP 4. Call Proceeding 5. ARQ 6. ACF 7.Alerting 8.Connect H.245 Messages RTP Media Path RAS messages Call Signaling Messages Note: This diagram only illustrates a simple pointto-point call setup where call signaling is not routed to the gatekeeper. Refer to the H.323 recommendation for more call setup scenarios. Page 16 Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Session Initiation Protocol SIP SIP Services • Defined by IETF • SIP long-term vision All telephone calls and video conference calls take place over the Internet People are identified by names or e-mail addresses, rather than by phone numbers You can reach the callee, no matter where the callee roams, no matter what IP device the callee is currently using • SIP is an application layer signaling protocol that defines initiation, modification and termination of interactive multimedia communication sessions between multiple users • Bases upon HTTP concepts (message syntax, SIP URLs, responses, …) Chapter 3.2: Transfer and Control Protocols Page 17 Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Chapter 3.2: Transfer and Control Protocols Determine current IP address of callee • Maps mnemonic identifier to current IP address Call management • Add new media streams during call • Change encoding during call • Invite others • Transfer and hold calls Chapter 3.2: Transfer and Control Protocols Page 18 Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Setting up a Call to a known IP Address µ Setting up a call • Provides mechanisms for caller to let callee know he wants to establish a call • Provides mechanisms so that caller and callee can agree on media type and encoding • Provides mechanisms to end call Call Setup • Alice’s SIP invite message indicates her port number & IP address. Indicates encoding that Alice prefers to receive (PCM µlaw) • Bob’s 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 506. Page 19 • Codec negotiation Suppose Bob doesn’t have PCM µlaw encoder Bob will instead reply with 606 Not Acceptable Reply and list encoders he can use Alice can then send a new INVITE message, advertising an appropriate encoder • Rejecting the call Bob can reject with replies “busy,” “gone,” “payment required,” “forbidden” • Media can be sent over RTP or some other protocol. Chapter 3.2: Transfer and Control Protocols Page 20 Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Example of SIP message Name Translation and User Location Here we don’t know Bob’s IP address. Intermediate SIP servers will be necessary. INVITE sip:[email protected] SIP/2.0 Via: SIP/2.0/UDP 167.180.112.24 From: sip:[email protected] To: sip:[email protected] Call-ID: [email protected] Content-Type: application/sdp Content-Length: 885 Alice sends and receives SIP messages using the SIP default port number 506. c=IN IP4 167.180.112.24 m=audio 38060 RTP/AVP 0 Alice specifies in Via: header that SIP client sends and receives SIP messages over UDP Notes: • HTTP message syntax • sdp = session description protocol • Call-ID is unique for every call. Page 21 Chapter 3.2: Transfer and Control Protocols • Caller wants to call callee, but only has callee’s name or e-mail address • Need to get IP address of callee’s 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 (don’t 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 registrar server • SIP proxy server • SIP redirect server • SIP location server Chapter 3.2: Transfer and Control Protocols Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme SIP Distributed Architecture SIP Registrar • User Agent Client (UAC) – An entity that initiates a call • User Agent Server (UAS) – An entity that receives a call SIP Components Location Server Redirect Server Page 22 Registrar Server Register Message: • • • • • PSTN User Agent • When Bob starts SIP client, the client sends SIP REGISTER message to Bob’s registrar server REGISTER sip:domain.com SIP/2.0 Via: SIP/2.0/UDP 193.64.210.89 From: sip:[email protected] To: sip:[email protected] Expires: 3600 Gateway Proxy Server Chapter 3.2: Transfer and Control Protocols Proxy Server Page 23 Chapter 3.2: Transfer and Control Protocols Page 24 Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme SIP Proxy Example SIP registrar upenn.edu • Alice sends invite message to her proxy server contains address sip:[email protected] Caller [email protected] places a call to [email protected] (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 [email protected] (4) umass proxy sends INVITE to eurecom registrar (5) eurecom regristrar forwards INVITE to 197.87.54.21, which is running keith’s SIP client • 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 Bob’s IP address • Interprets, rewrites or translates a request message before forwarding it • Note: proxy is analogous to local DNS server Page 25 Chapter 3.2: Transfer and Control Protocols Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme 4 5 7 8 6 9 SIP client 217.123.56.89 SIP client 197.87.54.21 (6-8) SIP response sent back (9) Messages sent directly between clients Note: also a SIP ack message, which is not shown Chapter 3.2: Transfer and Control Protocols Page 26 Transport Subsystem • H.323 comes from the ITU (telephony) • SIP comes from IETF: Borrows much of its concepts from HTTP. SIP has a Web flavor, whereas H.323 has a telephony flavor How to transfer multimedia data in the Internet? • TCP/UDP/IP: “best-effort service” • No guarantees on delay, loss → Today’s Internet multimedia applications use application-level techniques to mitigate (as best as possible) effects of delay and loss E.g. streamed stored multimedia • Application-level streaming techniques for making the best out of best effort service: Client side buffering Use of UDP versus TCP Multiple encodings of multimedia But: what protocols on lower layers are suitable to support such application-level streaming? H.323 is complex – SIP uses the KISS principle: Keep it simple and stupid Chapter 3.2: Transfer and Control Protocols 1 3 Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Comparison with H.323 • H.323 is a complete, vertically integrated suite of protocols for multimedia conferencing: signaling, registration, admission control, transport and codecs • SIP is a single component. Works with RTP, but does not mandate it. Can be combined with other protocols and services. SIP registrar eurecom.fr 2 SIP proxy umass.edu Page 27 Chapter 3.2: Transfer and Control Protocols Page 28 Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Internet Multimedia: Simplest Approach Internet Multimedia: Streaming Approach First: how can application level streaming be realized? • Audio or video stored in files • Files are transferred as HTTP object Received in entirety at client Then passed to player • • • • Audio and video are not really streamed: • Long delays until playout! Chapter 3.2: Transfer and Control Protocols Page 29 Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Browser GETs metafile with server contact information Browser launches player, passing metafile Player contacts server Server streams audio/video to player Page 30 Chapter 3.2: Transfer and Control Protocols Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Streaming from a Streaming Server Streaming Multimedia: Client Buffering constant drain rate d variable fill rate x(t) buffered video • Separation of web server and streaming • This architecture allows for non-HTTP protocol between server and media player • Can also use UDP instead of TCP Chapter 3.2: Transfer and Control Protocols Page 31 • In streaming, data can arrive with variable rate by network delay and jitter • Thus: client-side buffering for playout delay for compensation of these problems Chapter 3.2: Transfer and Control Protocols Page 32 Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Streaming Multimedia Solution: RTSP What transport protocol to use for such an approach? HTTP • Does not target multimedia content • No commands for fast forward, etc. UDP • Server sends at rate appropriate for client (oblivious to network congestion !) • Often send rate = encoding rate = constant rate • Then: fill rate = constant rate - packet loss • Short playout delay (2-5 seconds) to compensate for network jitter • Error recovery: if time permits Real-time Streaming Protocol RTSP • Client-server application layer protocol • For user to control display: rewind, fast forward, pause, resume, repositioning, etc… What it doesn’t do: • Does not define how audio/video is encapsulated for streaming over network • Does not restrict how streamed media is transported; it can be transported over UDP or TCP • Does not specify how the media player buffers audio/video TCP • Send at maximum possible rate under TCP • Fill rate fluctuates due to TCP congestion control • Larger playout delay: smooth TCP delivery rate • HTTP/TCP passes more easily through firewalls Chapter 3.2: Transfer and Control Protocols Page 33 Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Chapter 3.2: Transfer and Control Protocols Page 34 Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme RTSP: Out of Band Control RTSP Example Scenario: • Metafile communicated to web browser • Browser launches player • Player sets up an RTSP control connection and a data connection to streaming server FTP uses an “out-of-band” control channel: • A file is transferred over one TCP connection • Control information (directory changes, file deletion, file renaming, etc.) is sent over a separate TCP connection • The “out-of-band” and “in-band” channels use different port numbers RTSP messages are also sent out-of-band: • RTSP control messages use different port numbers than the media stream (Port 554): out-of-band • The media stream is considered “in-band” Chapter 3.2: Transfer and Control Protocols Page 35 Chapter 3.2: Transfer and Control Protocols Page 36 Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Metafile Example RTSP Exchange Example <title>Twister</title> <session> <group language=en lipsync> <switch> <track type=audio e="PCMU/8000/1" src = "rtsp://audio.example.com/twister/audio.en/lofi"> <track type=audio e="DVI4/16000/2" pt="90 DVI4/8000/1" src="rtsp://audio.example.com/twister/audio.en/hifi"> </switch> <track type="video/jpeg" src="rtsp://video.example.com/twister/video"> </group> </session> 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: npt=0C: PAUSE rtsp://audio.example.com/twister/audio.en/lofi RTSP/1.0 Session: 4231 Range: npt=37 C: TEARDOWN rtsp://audio.example.com/twister/audio.en/lofi RTSP/1.0 Session: 4231 S: 200 3 OK Page 37 Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Example: Internet Phone Jitter Cumulative data Introduce Internet Phone by way of an example • Speaker’s audio: alternating talk spurts, silent periods 64 kbit/s during talk spurt • Packets are generated only during talk spurts 20 msec chunks at 64 kbit/sec: 160 bytes data • Application-layer header added to each chunk • Chunk and header are encapsulated into a UDP segment. • Application sends UDP segments into socket every 20 msec during talkspurt Required: • Network loss: IP datagram lost due to network congestion (router buffer overflow) • Delay loss: IP datagram arrives too late for playout at receiver Delays: processing, queueing in network; end-system (sender, receiver) delays Typical maximum tolerable delay: 400 ms • Loss tolerance: depending on voice encoding, losses concealed, packet loss rates between 1% and 10% can be tolerated Chapter 3.2: Transfer and Control Protocols Page 38 Chapter 3.2: Transfer and Control Protocols Page 39 constant bit rate transmission client reception variable network delay (jitter) client playout delay constant bit rate playout at client buffered data Chapter 3.2: Transfer and Control Protocols C: SETUP rtsp://audio.example.com/twister/audio RTSP/1.0 Transport: rtp/udp; compression; port=3056; mode=PLAY time • Consider the end-to-end delays of two consecutive packets: difference can be more or less than 20 msec Chapter 3.2: Transfer and Control Protocols Page 40 Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Internet Phone: Fixed Playout Delay Adaptive Playout Delay Receiver attempts to playout each chunk exactly q msecs after chunk was generated • chunk has timestamp t: r: receiving of first packet play out chunk at t + q p: first playout schedule • chunk arrives after t + q: p’: second playout schedule data arrives too late for playout, data “lost” Tradeoff for q: • large q: less packet loss • small q: better interactive experience • Goal: minimize playout delay, keeping late loss rate low • Approach: adaptive playout delay adjustment: Estimate network delay, adjust playout delay at beginning of each talk spurt Silent periods compressed and elongated Chunks still played out every 20 msec during talk spurt. ti = timestamp of the ith packet ri = the time packet i is received by receiver pi = the time packet i is played at receiver di* = ri − t i = network delay for ith packet di = estimate of average network delay after receiving ith packet Dynamic estimate of average delay at receiver: where u is a fixed constant (e.g., u = .01) 20 msec Chapter 3.2: Transfer and Control Protocols d i = (1 − u ) ⋅ d i −1 + u ⋅ d i* Page 41 Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Chapter 3.2: Transfer and Control Protocols Page 42 Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Adaptive Playout Delay Recovery from Packet Loss Also useful to estimate the average deviation of the delay vi (jitter): v i = (1 − u ) ⋅ v i −1 + u⋅ | d i* − d i | The estimates di and vi are calculated for every received packet, although they are only used at the beginning of a talk spurt. For first packet in talk spurt, playout time is: pi = t i + d i + Kv i where K is a positive constant. Remaining packets in talkspurt are played out periodically Chapter 3.2: Transfer and Control Protocols Page 43 Forward error correction (FEC): simple scheme • For every group of n chunks create a redundant chunk by exclusive OR-ing the n original chunks • Send out n+1 chunks, increasing the bandwidth by factor 1/n. • Can reconstruct the original n chunks if there is at most one lost chunk from the n+1 chunks • Playout delay needs to be fixed to the time to receive all n+1 packets • Tradeoff: increase n, less bandwidth waste increase n, longer playout delay increase n, higher probability that 2 or more chunks will be lost Chapter 3.2: Transfer and Control Protocols Page 44 Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Recovery from Packet Loss Recovery from Packet Loss Other FEC scheme: • “Piggyback lower quality stream” • Send lower resolution audio stream as the redundant information • For example, nominal stream PCM at 64 kbps and redundant stream GSM at 13 kbps Interleaving • Chunks are broken up into smaller units • For example, 45 msec units per chunk • Packet contains small units from different chunks lower quality • Whenever there is non-consecutive loss, the receiver can conceal the loss • Can also append (n-1)st and (n-2)nd low-bit rate chunk Chapter 3.2: Transfer and Control Protocols Page 45 Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Chapter 3.2: Transfer and Control Protocols Page 46 Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Summary: Internet Multimedia: Bag of Tricks Real-Time Protocol (RTP) • Use UDP to avoid TCP congestion control (delays) for time-sensitive traffic • Client-side adaptive playout delay to compensate for network delay • Server side matches stream bandwidth to available client-to-server path bandwidth Chose among pre-encoded stream rates Dynamic server encoding rate • Error recovery (on top of UDP) FEC, interleaving Retransmissions, time permitting Conceal errors: repeat nearby data → Provide a standardized transport protocol which supports such tricks: RTP Chapter 3.2: Transfer and Control Protocols • If packet is lost, still have most of every chunk • Has no redundancy overhead • But adds to playout delay Page 47 RTSP still would have to use the unreliable UDP or the “slow” TCP – better define a “new” transport protocol for combining speed with reliability: Real-Time Transport Protocol (RTP) • RTP specifies a packet structure for packets carrying audio and video data • RTP packet provides Payload type identification Packet sequence numbering Timestamping • RTP runs in the end systems • RTP packets are encapsulated in UDP segments • Interoperability: if two Internet phone applications run RTP, then they may be able to work together Chapter 3.2: Transfer and Control Protocols Page 48 Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme RTP runs on Top of UDP RTP Header RTP libraries provide a transport-layer interface that extend UDP: • Port numbers, IP addresses • Payload type identification • Packet sequence numbering • Time-stamping Transport Layer Chapter 3.2: Transfer and Control Protocols Page 49 Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme • • • • • • Ver.: Version number of the RTP protocol in use P: packet size was padded to a multiple of 32 bit X: an extension header is used CC: indicates the number of sources M: User-specific mark. Can e.g. mark the beginning of a word on an audio channel. Contributing Source Identifier: used by mixers in the studio. The mixed flows are listed here. Chapter 3.2: Transfer and Control Protocols Page 50 Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme RTP Header RTP Header Payload Type (7 bits) Indicates type of encoding currently being used. If the sender changes encoding in middle of transmission, it informs the receiver through this payload type field • Payload type 0: PCM µ-law, 64 kbps • Payload type 3, GSM, 13 kbps • Payload type 26, Motion JPEG • Payload type 31, H.261 • Payload type 33, MPEG2 video Timestamp field (32 bits long) • Reflects the sampling instant of the first byte in the RTP data packet • For audio, timestamp clock typically increments by one for each sampling period (for example, each 125 µsecs for a 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. • The timestamp gives the receiver the relative time (with respect to the first data) when to playout the data 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 Synchronization Source Identifier field (32 bits long) • Identifies the source of the RTP stream • Each stream in a RTP session should have a distinct identifier Chapter 3.2: Transfer and Control Protocols Page 51 Chapter 3.2: Transfer and Control Protocols Page 52 Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme RTP and QoS Real-Time Control Protocol (RTCP) • RTP only adds some information to the UDP header needed for kind of reliability • RTP does not provide any mechanism to ensure timely delivery of data or provide other quality of service guarantees • RTP encapsulation is only seen at the end systems: it is not seen by intermediate routers. Routers providing best-effort service do not make any special effort to ensure that RTP packets arrive at the destination in a timely matter. • Usage of (and reaction to) the information in the RTP header are left over to the application Page 53 Chapter 3.2: Transfer and Control Protocols Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme • Works in conjunction with RTP • Each participant in RTP session periodically transmits RTCP control packets to all other participants • Each RTCP packet contains sender and/or receiver reports report statistics useful to application • Statistics include number of packets sent, number of packets lost, interarrival jitter, etc. • Feedback can be used to control performance Sender may modify its transmissions based on feedback • To limit traffic, each participant reduces his RTCP traffic as the number of conference participants increases Page 54 Chapter 3.2: Transfer and Control Protocols Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme RTCP Application Example: Voice over IP (VoIP) RTCP controls the data flow: • Feedback to the sender about QoS on receiver side • Data losses, delay and jitter are reported • Note: RTCP does not provide corrective actions - this is left over to the application Sender Application Receiver Application RTP / RTCP RTP / RTCP UDP UDP IP IP RTP RTCP RTP RTP RTCP Chapter 3.2: Transfer and Control Protocols RTP RTP RTCP Telephony using an IP network with standardized protocols: VoIP • Transferring speech and signaling information IP network • Not only internally in a IP phones (Internet/Intranet) IP network, also integration with “normal” IP terminal telephony systems IP addresses and virtual phone numbers VoIP Gateway Telecommunication network RTP RTCP ISDN phone Page 55 Chapter 3.2: Transfer and Control Protocols Phone numbers Page 56 Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme VoIP-based Telephony System Realization with H.323 H.323 zone Company central Branch ISDN ISDN PTSS ISDN PTSS Teleworking PCs VoIPGateway Network without QoS guarantees VoIPGateway IP network (Internet) R H.323 terminal H.323 terminal MCU Gateway POTS R R = Router PTSS = Private Telecommunications Switching System Page 57 Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme ATM network ISDN H.324 Chapter 3.2: Transfer and Control Protocols Gatekeeper H.320 H.321 H.323 gives us all functionality we need to realize an IP-based telephony integrated with conventional solutions Chapter 3.2: Transfer and Control Protocols Page 58 Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme Call Setup VoIP Future PTSS IP phone Intranet ISDN ISDN phone VoIP Gateway GK Phone nr =>IP-Adr.? Ringing IP[TCP[SETUP[...] ]] GK: Gatekeeper Pick up receiver SETUP [...] Call Proceeding IP[TCP[Alerting [...]]] Alerting IP[TCP[Connectt[...] ]] Connect RTP channel B channel IP[UDP[RTP[Voice]]] Voice Chapter 3.2: Transfer and Control Protocols Call is initiated Dialing tone At the moment, VoIP products based on H.323 are most popular • But: complex, and telecommunication networks tend to converge with IP networks → Use protocols better integrated with the IP world → SIP together with a MGCP (Media Gateway Control Protocol) gets more and more significance → Better integration with web applications → SIP seems to be the multimedia signaling protocol for the future Connection Still a problem: quality of an IP transmission; how to improve QoS in the Internet? Page 59 Chapter 3.2: Transfer and Control Protocols Page 60