8.2 Collision Resolution and Loop Detection
Connected: An Internet Encyclopedia
8.2 Collision Resolution and Loop Detection
Up:
Connected: An Internet Encyclopedia
Up:
Requests For Comments
Up:
RFC 1889
Up:
8. SSRC Identifier Allocation and Use
Prev: 8.1 Probability of Collision
Next: 9. Security
8.2 Collision Resolution and Loop Detection
8.2 Collision Resolution and Loop Detection
Although the probability of SSRC identifier collision is low, all RTP
implementations must be prepared to detect collisions and take the
appropriate actions to resolve them. If a source discovers at any
time that another source is using the same SSRC identifier as its
own, it must send an RTCP BYE packet for the old identifier and
choose another random one. If a receiver discovers that two other
sources are colliding, it may keep the packets from one and discard
the packets from the other when this can be detected by different
source transport addresses or CNAMEs. The two sources are expected to
resolve the collision so that the situation doesn't last.
Because the random identifiers are kept globally unique for each RTP
session, they can also be used to detect loops that may be introduced
by mixers or translators. A loop causes duplication of data and
control information, either unmodified or possibly mixed, as in the
following examples:
- A translator may incorrectly forward a packet to the same
multicast group from which it has received the packet, either
directly or through a chain of translators. In that case, the
same packet appears several times, originating from different
network sources.
- Two translators incorrectly set up in parallel, i.e., with the
same multicast groups on both sides, would both forward packets
from one multicast group to the other. Unidirectional
translators would produce two copies; bidirectional translators
would form a loop.
- A mixer can close a loop by sending to the same transport
destination upon which it receives packets, either directly or
through another mixer or translator. In this case a source
might show up both as an SSRC on a data packet and a CSRC in a
mixed data packet.
A source may discover that its own packets are being looped, or that
packets from another source are being looped (a third-party loop).
Both loops and collisions in the random selection of a source
identifier result in packets arriving with the same SSRC identifier
but a different source transport address, which may be that of the
end system originating the packet or an intermediate system.
Consequently, if a source changes its source transport address, it
must also choose a new SSRC identifier to avoid being interpreted as
a looped source. Loops or collisions occurring on the far side of a
translator or mixer cannot be detected using the source transport
address if all copies of the packets go through the translator or
mixer, however collisions may still be detected when chunks from two
RTCP SDES packets contain the same SSRC identifier but different
CNAMEs.
To detect and resolve these conflicts, an RTP implementation must
include an algorithm similar to the one described below. It ignores
packets from a new source or loop that collide with an established
source. It resolves collisions with the participant's own SSRC
identifier by sending an RTCP BYE for the old identifier and choosing
a new one. However, when the collision was induced by a loop of the
participant's own packets, the algorithm will choose a new identifier
only once and thereafter ignore packets from the looping source
transport address. This is required to avoid a flood of BYE packets.
This algorithm depends upon the source transport address being the
same for both RTP and RTCP packets from a source. The algorithm would
require modifications to support applications that don't meet this
constraint.
This algorithm requires keeping a table indexed by source identifiers
and containing the source transport address from which the identifier
was (first) received, along with other state for that source. Each
SSRC or CSRC identifier received in a data or control packet is
looked up in this table in order to process that data or control
information. For control packets, each element with its own SSRC,
for example an SDES chunk, requires a separate lookup. (The SSRC in a
reception report block is an exception.) If the SSRC or CSRC is not
found, a new entry is created. These table entries are removed when
an RTCP BYE packet is received with the corresponding SSRC, or after
no packets have arrived for a relatively long time (see Section
6.2.1).
In order to track loops of the participant's own data packets, it is
also necessary to keep a separate list of source transport addresses
(not identifiers) that have been found to be conflicting. Note that
this should be a short list, usually empty. Each element in this list
stores the source address plus the time when the most recent
conflicting packet was received. An element may be removed from the
list when no conflicting packet has arrived from that source for a
time on the order of 10 RTCP report intervals (see Section 6.2).
For the algorithm as shown, it is assumed that the participant's own
source identifier and state are included in the source identifier
table. The algorithm could be restructured to first make a separate
comparison against the participant's own source identifier.
IF the SSRC or CSRC identifier is not found in the source
identifier table:
THEN create a new entry storing the source transport address
and the SSRC or CSRC along with other state.
CONTINUE with normal processing.
(identifier is found in the table)
IF the source transport address from the packet matches
the one saved in the table entry for this identifier:
THEN CONTINUE with normal processing.
(an identifier collision or a loop is indicated)
IF the source identifier is not the participant's own:
THEN IF the source identifier is from an RTCP SDES chunk
containing a CNAME item that differs from the CNAME
in the table entry:
THEN (optionally) count a third-party collision.
ELSE (optionally) count a third-party loop.
ABORT processing of data packet or control element.
(a collision or loop of the participant's own data)
IF the source transport address is found in the list of
conflicting addresses:
THEN IF the source identifier is not from an RTCP SDES chunk
containing a CNAME item OR if that CNAME is the
participant's own:
THEN (optionally) count occurrence of own traffic looped.
mark current time in conflicting address list entry.
ABORT processing of data packet or control element.
log occurrence of a collision.
create a new entry in the conflicting address list and
mark current time.
send an RTCP BYE packet with the old SSRC identifier.
choose a new identifier.
create a new entry in the source identifier table with the
old SSRC plus the source transport address from the packet
being processed.
CONTINUE with normal processing.
In this algorithm, packets from a newly conflicting source address
will be ignored and packets from the original source will be kept.
(If the original source was through a mixer and later the same source
is received directly, the receiver may be well advised to switch
unless other sources in the mix would be lost.) If no packets arrive
from the original source for an extended period, the table entry will
be timed out and the new source will be able to take over. This might
occur if the original source detects the collision and moves to a new
source identifier, but in the usual case an RTCP BYE packet will be
received from the original source to delete the state without having
to wait for a timeout.
When a new SSRC identifier is chosen due to a collision, the
candidate identifier should first be looked up in the source
identifier table to see if it was already in use by some other
source. If so, another candidate should be generated and the process
repeated.
A loop of data packets to a multicast destination can cause severe
network flooding. All mixers and translators are required to
implement a loop detection algorithm like the one here so that they
can break loops. This should limit the excess traffic to no more than
one duplicate copy of the original traffic, which may allow the
session to continue so that the cause of the loop can be found and
fixed. However, in extreme cases where a mixer or translator does not
properly break the loop and high traffic levels result, it may be
necessary for end systems to cease transmitting data or control
packets entirely. This decision may depend upon the application. An
error condition should be indicated as appropriate. Transmission
might be attempted again periodically after a long, random time (on
the order of minutes).
Next: 9. Security
Connected: An Internet Encyclopedia
8.2 Collision Resolution and Loop Detection
|