Make TS inputs slightly more robust against packet loss

This commit is contained in:
Thulinma 2021-12-30 17:12:54 +01:00
parent 13e04ce608
commit 1ec18d83b8

View file

@ -522,14 +522,14 @@ namespace TS{
} }
if (paySize - offset - pesOffset < realPayloadSize){ if (paySize - offset - pesOffset < realPayloadSize){
WARN_MSG("Packet loss detected (%" PRIu64 " != %" PRIu64 "), glitches will occur", WARN_MSG("Packet loss detected (%" PRIu64 " != %" PRIu64 "), throwing away data to compensate",
paySize - offset - pesOffset, realPayloadSize); paySize - offset - pesOffset, realPayloadSize);
realPayloadSize = paySize - offset - pesOffset; realPayloadSize = paySize - offset - pesOffset;
} }else{
const char *pesPayload = pesHeader + pesOffset; const char *pesPayload = pesHeader + pesOffset;
parseBitstream(tid, pesPayload, realPayloadSize, timeStamp, timeOffset, bPos, pesHeader[6] & 0x04); parseBitstream(tid, pesPayload, realPayloadSize, timeStamp, timeOffset, bPos, pesHeader[6] & 0x04);
lastms[tid] = timeStamp; lastms[tid] = timeStamp;
}
// Shift the offset by the payload size, the mandatory headers and the optional // Shift the offset by the payload size, the mandatory headers and the optional
// headers/padding // headers/padding