Lehrstuhl Für Informatik 4 Kommunikation Und Verteilte Systeme
Lehrstuhl Für Informatik 4 Kommunikation Und Verteilte Systeme
Lehrstuhl Für Informatik 4 Kommunikation Und Verteilte Systeme
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.4: Synchronization
• Synchronization • Computer Clocks
• Multimedia • Network Time Protocol
Operating Systems • One-way Delay
Chapter 4: Multimedia Systems Measurements
– Storage Aspects • Synchronization of Media
Streams
Chapter 5: Multimedia Usage
Why Synchronization?
Necessity:
• Synchronization of different media streams, e.g. in videoconferencing: audio and
video are transmitted as two independent streams: synchronization has to take
place when streams are played
• Furthermore: distributed operations must be coordinated for in-time data delivery
and buffer management
• Most media synchronization schemes demand for knowledge about temporal
relations between source and sink(s) → accurate global time scale required
Example: Audio/Video presentation
with multiple sources Clock offset Source A: Network
• Presentation at sink A ↔ C: OAC Audio delay DAC
must start at TC
• Sources A and B must
start at TC - OAC - DAC Sink C
and TC - OBC - DBC
• Problem: OAC, OBC, Clock offset Source B: Network
DAC, DBC unknown B ↔ C: OBC Video delay DBC
Chapter 3.4: Synchronization Page 2
Lehrstuhl für Informatik 4
Kommunikation und verteilte Systeme
Computer Clocks
i.e. up to ≈ 1 ms / day
Stratum-1 Client
Stratum-2 Stratum-3
NTP Hierarchy
θ iest : =
(t i ,1 − ti ,0 ) − ( t i ,3 − ti ,2 )
=
2.00.00.017 − ( −1.59.59.967 )
= 1.59.59.992 = θ i +
εi
2 2 2
NTP Algorithm
A B
ti,0
me
ssa
ge
t i ,0 + t i ,3 1
2
θiest = estimation of
offset between A and B
ti,3
me s
sage
2 ti,1
t i ,1 + t i ,2
2
ti,2
time time
Chapter 3.4: Synchronization Page 8
Lehrstuhl für Informatik 4
Kommunikation und verteilte Systeme
NTP Algorithm
→ θ iest =
(t i ,1 − ti ,3 ) − ( ti ,0 − t i ,2 )
2
=
( t c
i ,1 − t ic,3 ) (
− ( t i ,0 − ti ,2 ) + ε iS − ε iR )
2
ε iS − ε iR
= θi +
2
Applicability of NTP
Problems
• Estimated time depends on packet delays, which are mostly non-symmetric
→ Accuracy drops in case of asymmetric routing and high network load
• Typical precision in the order of a few tens of ms (even for time servers!)
• Errors propagate through the synchronization network
• Slow clock adaptation by tick adjustment of client clock counter
→ Oscillations with amplitudes as high as 10 ms
Still: Sufficient accuracy for most multimedia applications ...
... but not for delay measurements:
• Mean one-way delays in national WANs (e.g. GWIN) usually well below 20ms
→ NTP’s “long-term” accuracy not sufficient here
→ New measurement approach needed
• Approach:
Delay measurement to first synchronize oscillator frequencies
Correction of timestamps by measured drift
Subsequent estimation of clock offset
• Drift influence on delays: 1000 probe packets, 10 s interdeparture delay
cisco-rz.rz.rwth-aachen.de rcs2.urz.tu-dresden.de
80
100 Round-Trip 60
0 Forward path 40
Return path
-100 20
-200 0
0 1000 2000 3000 4000 5000 0 1000 2000 3000 4000 5000
Time [seconds] Time [seconds]
• Drift estimation:
Measured latencies show clear linear behavior, errors due to delay variances
Running minimum approach to eliminate delay fluctuations
Linear regression on first derivate yields estimator for relative drift
• Running minima: minimum calculated for a window size of 50 packets (500 s)
cisco-rz.rz.rwth-aachen.de rcs2.urz.tu-dresden.de
100 Round-Trip 40
Forward path 30
0
Return path 20
-100
10
-200 0
0 1000 2000 3000 4000 5000 0 1000 2000 3000 4000 5000
Time [seconds] Time [seconds]
Chapter 3.4: Synchronization Page 12
Lehrstuhl für Informatik 4
Kommunikation und verteilte Systeme
t inew
,o = t i ,0 + fdrift ⋅ ( t i ,0 − t 0 ) and t new
i ,3 = t i ,3 + fdrift ⋅ ( t i ,3 − t 0 )
adaptation of sender
where t0 indicates the start of the sampling period
times ti,0 and ti,3 by
• Goodness of estimation indicators: average drift
Equal drift amount on both paths
First derivate of running minima is a constant function
• Several enhancements of this basic algorithm are possible
Chapter 3.4: Synchronization Page 13
Lehrstuhl für Informatik 4
Kommunikation und verteilte Systeme
• Clock offset: difference between sender and receiver clock for arbitrary packet j:
Offset at tj,3: θestj = tj,2 + estimated delay of packet j on return path
• Algorithm performs better than NTP
• Drawback: Higher overhead due to more measurement packets
cisco-rz.rz.rwth-aachen.de rcs2.urz.tu-dresden.de
1 1
0.8 0.8
Round-Trip
0.6 0.6
Forward path
0.4 Return path 0.4
0.2 0.2
0 0
-5 0 5 10 15 20 0 10 20 30 40 50 60 70
Time [seconds] Time [seconds]
Example benefits:
• Computation of jitter distribution at the receiver (→ buffer requirements)
• Detection of network bottlenecks (compare forward vs. return path to Dresden)
Chapter 3.4: Synchronization Page 15
Lehrstuhl für Informatik 4
Kommunikation und verteilte Systeme
Synchronization in principle also is part of QoS, related to the playout of multimedia data:
• QoS specification of single Logical Data Units (LDUs), e.g.
Modified requirements:
AE-V ∈ [-80:80]
→ AE - AS = (AE-V) + (V-AS) ∈ [-160:160]
V-AS ∈ [-80:80]
Synchronization Specification
Synchronization Specification
Requirements
• Treatment of each media object as a single logical unit
• Abstraction of the media object contents
• Easy description of all types of synchronization
• Integration of time-dependent and time-independent media objects
• Handling of user interaction
• Definition of QoS requirements
• Support of hierarchical levels of synchronization (for complex scenarios)
Methods
• Interval-based specification
• Axes-based synchronization
• Control flow-based synchronization
Hierarchical specification
Specification via reference points
Timed Petri Networks
• Event-based synchronization
• Scripts
Chapter 3.4: Synchronization Page 21
Lehrstuhl für Informatik 4
Kommunikation und verteilte Systeme
A Interaction
RI
A2 P4
V P1 P2 P3
AN1 AN2 AN3
α β γ ε χ
Interval-based Specification
A B A meets B A B
A before B
A A during B A
A overlaps B
B B
A A finishes B A
A starts B
B B
A equals B A
Enhanced interval-based method:
B • 29 interval relations can be specified
• 10 operations defined to handle these
temporal relations
(before, cobegin, coend, overlaps, while, ...)
Chapter 3.4: Synchronization Page 23
Lehrstuhl für Informatik 4
Kommunikation und verteilte Systeme
Interval-based Specification
A A A A
δ1 δ1 δ1
δ1
B B B B
before(δ1) beforeendof(δ1) cobegin(δ1) coend(δ1)
A A A A A
δ1 δ2 δ2 δ2 δ2 δ2
δ1 δ1 δ1 δ1
B B B B B
while(δ1, δ2) delayed(δ1, δ2) startin(δ1, δ2) endin(δ1, δ2) cross(δ1, δ2)
Interval-based Specification
A
δ2
δ1 δ3
B
overlaps(δ1, δ2, δ3)
A2
A1
I
RI
P1 P2 P3 P4
V
Audio1 cobegin(0) Video
Animation
Audio1 coend(0) Video /* i.e., Lip synchronization
*/ AN1 AN2 AN3
Audio1 before(0) RecordedInteraction
RecordedInteraction before(0) Picture1
Picture1 before(0) Picture2
Picture2 before(0) Picture3
Picture3 before(0) Interaction
Picture3 before(0) Animation
Animation while(2,5) Audio2
Chapter 3.4: Synchronization
Interaction before(0) Picture4 Page 26
Lehrstuhl für Informatik 4
Kommunikation und verteilte Systeme
Interval-based Specification
Advantages:
• Easy to handle open (i.e., non-predictable) LDUs (closed LDU: predictable duration,
open LDU: non-predictable duration, typical for live sources, e.g. objects which include
an user interaction)
→ easy to handle user interaction
• Possibility of specifying additional indeterministic temporal relations by defining
intervals for durations and delays
• Disjunction of operators supported (e.g., “not parallel“)
→ Flexible model that supports many run-time presentation variations
Disadvantages:
• Model does not include skew specifications
• No direct specification of relations between subunits of media objects possible
• Flexible specification leads to possible inconsistencies
Example: (A not in parallel with B) & (A while(2,3) User Interaction) &
(User Interaction before(0) B)
→ Conflict: B must be started at end of interaction, but A may still run!
Chapter 3.4: Synchronization Page 27
Lehrstuhl für Informatik 4
Kommunikation und verteilte Systeme
Axes-based Synchronization
Synchronization is based on global timing:
• All objects are attached to a time axis representing an abstraction of real-time, which
is shared among all objects
• Removing one object does not affect other objects
• Synchronization of objects only based on fixed points of time → very good for closed
LDUs, several problems with open LDUs
RI Interaction
unknown duration
A1 P1 P2 P3
Animation
V
P4
A2
?
Time unknown!
Different possibilities:
1. Global timer: all objects attached to a global time axis
2. Virtual time axis: coordinate systems with user defined measurement units;
Chapter 3.4: Synchronization
possibly several time axes are used simultaneously, e.g. for musical notes Page 28
Lehrstuhl für Informatik 4
Kommunikation und verteilte Systeme
Advantages Disadvantages
• Easy to understand • Synchronization only possible at the beginning or at
• Natural support of hierarchies the end, thus a split of “Animation“ into AN1, AN2,
• Integration of interactive objects AN3 was necessary
• Skew QoS not definable
• Presentation durations must be added
• Some synchronization scenarios cannot be described
Chapter 3.4: Synchronization Page 30
Lehrstuhl für Informatik 4
Kommunikation und verteilte Systeme
Audio
Audio 1 P1 P2 P3 Audio 2 P4
Animation
Video
Animation 1
Animation 2
Problems:
Animation 3
• Requires mechanism for detecting inconsistencies
• Does not allow specification of delays
Chapter 3.4: Synchronization
• Possible solution: Inclusion of a global timer as a reference axis Page 32
Lehrstuhl für Informatik 4
Kommunikation und verteilte Systeme
Transition T1
Input Output
Place Place
of T1 of T1
Token Arcs
Chapter 3.4: Synchronization Page 33
Lehrstuhl für Informatik 4
Kommunikation und verteilte Systeme
V1 V1
33 ms 33 ms
A1/V RI P1 P2 P3
A2
60s 20s 5s 5s 5s
AN1 AN3
AN2
=
ˆ D
Chapter 3.4: Synchronization Page 35
Lehrstuhl für Informatik 4
Kommunikation und verteilte Systeme
Event-based Synchronization
Presentations are initiated by synchronization events:
• Examples: start / stop / prepare a presentation
• Events that initiate representations may be external (e.g., timer-based) or internal
(e.g., media object reaching a specific LDU)
• Advantage: Easy integration of interactive objects
• Disadvantages:
Difficult to handle Event Audio1 Timer1
Start ...
Complex specification Object Stop Ready
Skew QoS cannot be defined Audio1 start
No hierarchies
Video start
Maintenance very difficult
Pic.1 start
Timer1 start(3)
Pic.2 start
action
Chapter 3.4: Synchronization Page 36
Lehrstuhl für Informatik 4
Kommunikation und verteilte Systeme
Scripts
• Elements: Activities and subscripts
• Often: Full programming language, extended by timing operations
• Different specification methods can be supported
• Example:
Script based on basic hierarchical method, which supports serial (“>>“-operator),
parallel (“&“-operator) and repeated presentation (“n“ denotes n-fold repetition):
Scripts
Advantages:
• Powerful and flexible programming environment
• Support of hierarchies and logical objects
• Easy integration of time-independent and interactive objects
Disadvantages:
• Difficult to handle: Procedural approach instead of declarative
• Complex specification
• Implicit usage of common timers necessary
• Special constructs for skew QoS necessary
Conclusions