Delay Jitter Ketan Mayer-Patel Comp 249 - Spring 2003 What is jitter? • Jitter: variation in delay – Can be measured as the variance of delay. Sender Reciever Comp 249 - Spring 2003 Elements of Delay • Packetization – Think of audio. • Propagation – Physical transmission. • Queuing – Routing, congestion, etc. – This is the part that is most variable. • Synchronization – May need to wait for corresponding samples from other streams. Comp 249 - Spring 2003 Elements of Delay Sampling Compress Packetization Transmission Reception Decompress Synchronize Display Comp 249 - Spring 2003 Sources of Jitter • In general, due to queuing effects. • When queue is building… – Competing traffic inserted between successive packets of a stream. • When queue is draining… – Probe compression. Comp 249 - Spring 2003 Jitter Buffer • In general, jitter is removed by buffering in the reciever. • Sources of delay and jitter considered a black box. Comp 249 - Spring 2003 Jitter Buffer Sampling Compress Packetization Transmission Reception Decompress Synchronize Display Usually here with hardware support. Usually here with software support. Comp 249 - Spring 2003 Why? • Why do we care about jitter anyway? – Smoothness of playback. – Inelastic media types. • What is the cost of a jitter buffer? – Increased end-to-end latency. – When will we care about this? • Interactive streams. • Live streams. – Stored playback applications can afford the cost of larger jitter buffers. Comp 249 - Spring 2003 Media Elasticity • Extent to which presentation time of one ADU is dependent on presentation times of previous ADU’s. – Video • Fairly elastic. – Audio • Fairly inelastic Comp 249 - Spring 2003 Jitter Buffer Design • On one extreme: static jitter buffer. – Total delay budget held at some static amount. – If ADU arrives late, same as if lost (i.e., discard) – I-policy [Naylor82] • On the other: constantly increasing buffer. – Every ADU is played. – Jitter buffer is adjusted to largest delay seen thus far. – E-policy Comp 249 - Spring 2003 I-policy • Establish jitter buffer on first ADU. p = t * r + off • • • • • Use first ADU to calculate offset. p = playout time t = timestamp of ADU r = period of ADU clock off = jitter buffer offset – Solve for off for first ADU. – Add jitter allowance to off. Comp 249 - Spring 2003 Example • Variance allowance = 60 ms • Media timestamp period = 30 ms • First ADU: – Media Timestamp = 10 – System Clock = 1000 • Solve for off: – 1000 = 10 * 30 + off => off = 700 • Add variance allowance – p = t * 30 + 760 Comp 249 - Spring 2003 I-policy • Maintain queue of incoming ADU’s and schedule playback of head. • Example: Packet a b c d e TS 10 11 12 13 14 ArrivalTime 1000 1025 1050 1095 1185 Comp 249 - Spring 2003 I-policy • Playback smoothness is achieved if arriving ADU’s delay average + max jitter is less than first ADU delay + jitter allowance. • What happens if initial delay is unrepresentative? Comp 249 - Spring 2003 E-policy • • • • Solve for off for every ADU. If late, adjust off. If early, queue. Again, maintain a queue and schedule playout of the head. • Basically keep adjusting playout delay for the largest delay experienced so far. • Accommodates jitter by definition. Comp 249 - Spring 2003 E-policy Packet a b c d e TS 10 11 12 13 14 Comp 249 - Spring 2003 ArrivalTime 1000 1025 1050 1095 1185 Adaptive Buffer Techniques • Between E and I are adaptive techniques. • Adaptively estimate delay variance. – Calculate off on a per ADU basis. – Maintain a weighted moving average for off. – Maintain a weighted moving average for variance of off. – Manage queue using off average + k * off variance where k is typically 2-4 p = t * r + (off + k * v) Comp 249 - Spring 2003 Moving Averages offnew estimate = offold estimate + x (offobserved – offold estimate) vnew estimate = vold estimate + x (|offobserved – offold estimate| – vold estimate) or offnew estimate = offold estimate + (1 – ) offobserved vnew estimate = vold estimate + (1 – ) x (|offobserved – offold estimate|) or offnew estimate = MIN(offobserved in the recent past) Comp 249 - Spring 2003 Adjusting Down • Extending jitter buffer delay is easy. • How do you make downward adjustments? • Two basic techniques: – Play faster – Drop ADU’s Comp 249 - Spring 2003 Adaptive Issues • What should k be? – Depends on variance distribution. • What should weighting coefficients be? – Tradeoff between stability and responsiveness. • What about inelastic media? – Truncating audio frames or allowing space between audio frames causes problems. Comp 249 - Spring 2003 Media Specific Techniques • For audio, can take advantage of “talkspurt” structure. • Make playout buffer adjustments in silence periods. Comp 249 - Spring 2003 Talkspurt Example off + kv Send a offnew + kvnew b c d e f g h Receive Playout Talkspurt i Comp 249 - Spring 2003 Talkspurt i+1 Agility vs. Stability • Tradeoff between agile and stable. – Controlled by gain parameter in moving weighted filters. • Agile – Weighs new measurements more than past measurements. – Reacts quickly to change. – Can react too quickly to transient changes. • Stable – Weighs past measurements more than new measurements – Change in value bounded to small percentage of current value. – Takes a while to react to fundamental changes. Comp 249 - Spring 2003 Kim and Noble 01 • Proposes three different filters which adaptively vary the gain parameter. – Flip-flop: detects when to use an agile gain and when to use a stable gain. • Control heuristics come from statistical process control world – Stability filter: adapts gain relative to current variance measure and recent variance range. – Error filter: adapts gain to reinforce “good” estimation behavior. • Concludes that FF filter works best in fairly wide spectrum of applications. • Work done in the mobile domain but very applicable to all areas of networking. Comp 249 - Spring 2003