When do we send duplicate Transport stream packets ? What should be done at demultiplexer when we receive duplicate TS packet?
2 Answers
MPEG-2 allows a maximum of two consecutive packets with the same PID and the same CC value. Duplicate and identical packets can be included for redundancy if the original packet holds important information. In this case if the first packet is lost or damaged the duplicate can be used instead. On the decoder you either discard it or use it depending on whether the original is valid.
Non-identical duplicate packets can also be used to hold extra information without the need to insert another PID. For example they can be used for encryption / content scrambling.
- 131
The MPEG2 System standard (13818-1) says:
"In transport streams, duplicate packets may be sent as two, and only two, consecutive transport stream packets of the same PID. The duplicate packets shall have the same continuity_counter value as the original packet and the
adaptation_field_control field shall be equal to '01' or '11'. In duplicate packets each byte of the original packet shall be duplicated, with the exception that in the program clock reference fields, if present, a valid value shall be encoded."
There is one very important point in the above statement - 'with the exception that in the program clock reference fields'.
Under some circumstances a duplicated packet can be different from the original one.
If a decoder senses two successive packets with the same PID and CC and PCR (program clock reference) is not signaled then it should compare these packets. If they are identical then the second packet is a replica of the first one. However, if PCR is transmitted then a decoder should compare both packets excluding PCR fields. if they are identical (excl. PCR) then the second packet is a replica of the first one.