Improve loop for TS input packet reader
This commit is contained in:
parent
7af419fdad
commit
98c50762e8
1 changed files with 9 additions and 8 deletions
|
@ -63,15 +63,20 @@ void parseThread(void * ignored) {
|
|||
|
||||
threadTimer[tid] = Util::bootSecs();
|
||||
while (Util::bootSecs() - threadTimer[tid] < THREAD_TIMEOUT && cfgPointer->is_active && (!liveStream.isDataTrack(tid) || myProxy.userClient.isAlive())) {
|
||||
liveStream.parse(tid);
|
||||
if (!liveStream.hasPacket(tid)){
|
||||
{
|
||||
tthread::lock_guard<tthread::mutex> guard(threadClaimMutex);
|
||||
threadTimer[tid] = Util::bootSecs();
|
||||
}
|
||||
if (liveStream.isDataTrack(tid)){
|
||||
myProxy.userClient.keepAlive();
|
||||
}
|
||||
liveStream.parse(tid);
|
||||
if (!liveStream.hasPacket(tid)){
|
||||
Util::sleep(100);
|
||||
continue;
|
||||
}
|
||||
while (liveStream.hasPacket(tid) && (Util::bootSecs() - threadTimer[tid] < THREAD_TIMEOUT && cfgPointer->is_active && (!liveStream.isDataTrack(tid) || myProxy.userClient.isAlive()))){
|
||||
uint64_t startSecs = Util::bootSecs();
|
||||
while (liveStream.hasPacket(tid) && ((Util::bootSecs() < startSecs + 2) && cfgPointer->is_active && (!liveStream.isDataTrack(tid) || myProxy.userClient.isAlive()))){
|
||||
liveStream.initializeMetadata(myMeta, tid);
|
||||
DTSC::Packet pack;
|
||||
liveStream.getPacket(tid, pack);
|
||||
|
@ -84,10 +89,6 @@ void parseThread(void * ignored) {
|
|||
myProxy.bufferLivePacket(pack, myMeta);
|
||||
}
|
||||
}
|
||||
{
|
||||
tthread::lock_guard<tthread::mutex> guard(threadClaimMutex);
|
||||
threadTimer[tid] = Util::bootSecs();
|
||||
}
|
||||
}
|
||||
std::string reason = "unknown reason";
|
||||
if (!(Util::bootSecs() - threadTimer[tid] < THREAD_TIMEOUT)){reason = "thread timeout";}
|
||||
|
|
Loading…
Add table
Reference in a new issue