Communications networks may transmit information in the form of data packets. The information may be divided into packets at a sender, transmitted from the sender to a receiver, and reassembled at the receiver to retrieve the information. These packets may be sent over a “lossy” communications medium that does not guarantee that a transmitted packet will actually reach its intended destination. Furthermore, is no guarantee that the packets will be received in the proper order, thus there may be a need to rearrange the packets at the receiver.
In order to detect packet loss and arrange the received packets in the proper order, the sender may append a continuity counter to the transmitted packets. The continuity counter may identify the packets using sequentially assigned identifiers. Because the continuity counter has a finite size, only a limited number of identifiers can be used. Accordingly, the identifiers are typically provided in a repeating sequence by applying sequential identifiers from a minimum identifier value through a maximum identifier value, and then returning to the minimum identifier number to create a repeating sequence of identifiers. One example of such a loop using a two-bit continuity counter (capable of representing four values) is “0-1-2-3-0-1-2-3-0-1-2-3- . . . ”
A similar example is depicted in FIG. 1A, where a data stream including twenty packets is transmitted from a sender. The data stream of FIG. 1A may represent, for example, an MPEG2 Transport Stream (“MPEG2-TS”) or any other suitable stream of packetized data. Each of the packets of the data stream includes a 4-bit continuity counter. A 4-bit counter is capable of representing sixteen values (e.g., zero through fifteen), and accordingly when the maximum value (fifteen) is reached, the continuity counter resets to the minimum value (zero) for the next packet. This procedure can be seen in the transition between Packet 16 and Packet 17 in FIG. 1A.
The continuity counter may be consulted as packets are received in order to detect packet loss. For example, as shown in FIG. 1B (which represents the data stream of FIG. 1A as received by a receiver), Packets 3-6 may be lost during transmission. Thus, the receiver receives Packet 1 having a continuity counter value of “0,” Packet 2 having a continuity counter value of “1,” and Packet 7 having a continuity counter value of “6.” By detecting the gap in the continuity counter values, the receiver may identify that Packets 3-6 are missing. If the missing packets do not arrive in a predetermined amount of time, then the receiver may request that Packets 3-6 be retransmitted.