Make sure DTS/PTS offsets in TS are always positive.

This commit is contained in:
Thulinma 2015-02-13 01:44:40 +01:00
parent 5adfe6b672
commit 033ec8d692

View file

@ -390,9 +390,9 @@ namespace TS {
strBuf.append("\000\000\001\340\000\000\204", 7); strBuf.append("\000\000\001\340\000\000\204", 7);
strBuf += (char)(offset ? 0xC0 : 0x80); //PTS/DTS + Flags strBuf += (char)(offset ? 0xC0 : 0x80); //PTS/DTS + Flags
strBuf += (char)(offset ? 0x0A : 0x05); //PESHeaderDataLength strBuf += (char)(offset ? 0x0A : 0x05); //PESHeaderDataLength
encodePESTimestamp(strBuf, (offset ? 0x30 : 0x20), PTS); encodePESTimestamp(strBuf, (offset ? 0x30 : 0x20), PTS + offset);
if (offset){ if (offset){
encodePESTimestamp(strBuf, 0x10, PTS + offset); encodePESTimestamp(strBuf, 0x10, PTS);
} }
} }
@ -406,9 +406,9 @@ namespace TS {
tmpStr.append("\000\000\001\340\000\000\204", 7); tmpStr.append("\000\000\001\340\000\000\204", 7);
tmpStr += (char)(offset ? 0xC0 : 0x80); //PTS/DTS + Flags tmpStr += (char)(offset ? 0xC0 : 0x80); //PTS/DTS + Flags
tmpStr += (char)(offset ? 0x0A : 0x05); //PESHeaderDataLength tmpStr += (char)(offset ? 0x0A : 0x05); //PESHeaderDataLength
encodePESTimestamp(tmpStr, (offset ? 0x30 : 0x20), PTS); encodePESTimestamp(tmpStr, (offset ? 0x30 : 0x20), PTS + offset);
if (offset){ if (offset){
encodePESTimestamp(tmpStr, 0x10, PTS + offset); encodePESTimestamp(tmpStr, 0x10, PTS);
} }
toSend.insert(0, tmpStr); toSend.insert(0, tmpStr);
} }