Fixed TS PTS rollover support
This commit is contained in:
parent
60e04c4058
commit
e4827ce615
2 changed files with 14 additions and 0 deletions
|
@ -430,6 +430,13 @@ namespace TS{
|
|||
}
|
||||
}
|
||||
|
||||
timeStamp += (rolloverCount[tid] * TS_PTS_ROLLOVER);
|
||||
|
||||
if ((timeStamp < lastms[tid]) && ((timeStamp + TS_PTS_ROLLOVER) > lastms[tid] )){
|
||||
++rolloverCount[tid];
|
||||
timeStamp += TS_PTS_ROLLOVER;
|
||||
}
|
||||
|
||||
|
||||
if (pesHeader[7] & 0x20){// ESCR - ignored
|
||||
pesOffset += 6;
|
||||
|
@ -454,6 +461,7 @@ namespace TS{
|
|||
|
||||
const char *pesPayload = pesHeader + pesOffset;
|
||||
parseBitstream(tid, pesPayload, realPayloadSize, timeStamp, timeOffset, bPos, pesHeader[6] & 0x04 );
|
||||
lastms[tid] = timeStamp;
|
||||
|
||||
// Shift the offset by the payload size, the mandatory headers and the optional
|
||||
// headers/padding
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <set>
|
||||
|
||||
#include "shared_memory.h"
|
||||
#define TS_PTS_ROLLOVER 95443718
|
||||
|
||||
namespace TS{
|
||||
enum codecType{H264 = 0x1B, AAC = 0x0F, AC3 = 0x81, MP3 = 0x03, H265 = 0x24, ID3 = 0x15, MPEG2 = 0x02, MP2 = 0x03};
|
||||
|
@ -83,6 +84,11 @@ namespace TS{
|
|||
std::map<unsigned long, std::string> mpeg2SeqHdr;
|
||||
std::map<unsigned long, std::string> mpeg2SeqExt;
|
||||
std::map<unsigned long, std::string> mp2Hdr;
|
||||
|
||||
|
||||
std::map<unsigned int, size_t> rolloverCount;
|
||||
std::map<unsigned int, unsigned long long> lastms;
|
||||
|
||||
mutable tthread::recursive_mutex tMutex;
|
||||
|
||||
bool threaded;
|
||||
|
|
Loading…
Add table
Reference in a new issue