Timing improvements for all outputs and DTSC socket input
This commit is contained in:
parent
2124d10a9b
commit
bd9ae56532
2 changed files with 10 additions and 9 deletions
|
@ -139,11 +139,11 @@ namespace DTSC{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!src.spool()){
|
if (!src.spool()){
|
||||||
if (sleepCount++ > 150){
|
if (sleepCount++ > 750){
|
||||||
WARN_MSG("Waiting for packet on connection timed out");
|
WARN_MSG("Waiting for packet on connection timed out");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Util::wait(100);
|
Util::sleep(20);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -969,6 +969,7 @@ namespace Mist{
|
||||||
if (!maxSkipAhead){
|
if (!maxSkipAhead){
|
||||||
bool noReturn = false;
|
bool noReturn = false;
|
||||||
uint64_t newSpeed = 1000;
|
uint64_t newSpeed = 1000;
|
||||||
|
if (extraKeepAway > 0){extraKeepAway--;}//Reduce extra latency if possible
|
||||||
if (lMs - mKa - needsLookAhead - extraKeepAway > cTime + 50){
|
if (lMs - mKa - needsLookAhead - extraKeepAway > cTime + 50){
|
||||||
// We need to speed up!
|
// We need to speed up!
|
||||||
uint64_t diff = (lMs - mKa - needsLookAhead - extraKeepAway) - cTime;
|
uint64_t diff = (lMs - mKa - needsLookAhead - extraKeepAway) - cTime;
|
||||||
|
@ -1169,9 +1170,9 @@ namespace Mist{
|
||||||
uint8_t i = 6;
|
uint8_t i = 6;
|
||||||
while (--i && thisPacket.getTime() > ((((Util::bootMS() - firstTime) * 1000) + maxSkipAhead) / realTime) &&
|
while (--i && thisPacket.getTime() > ((((Util::bootMS() - firstTime) * 1000) + maxSkipAhead) / realTime) &&
|
||||||
keepGoing()){
|
keepGoing()){
|
||||||
Util::sleep(std::min(thisPacket.getTime() -
|
uint64_t amount = thisPacket.getTime() - ((((Util::bootMS() - firstTime) * 1000) + maxSkipAhead) / realTime);
|
||||||
((((Util::bootMS() - firstTime) * 1000) + maxSkipAhead) / realTime),
|
if (amount > 1000){amount = 1000;}
|
||||||
1000ul));
|
Util::sleep(amount);
|
||||||
//Make sure we stay responsive to requests and stats while waiting
|
//Make sure we stay responsive to requests and stats while waiting
|
||||||
if (wantRequest){requestHandler();}
|
if (wantRequest){requestHandler();}
|
||||||
stats();
|
stats();
|
||||||
|
@ -1476,18 +1477,18 @@ namespace Mist{
|
||||||
//Okay, there's no next page yet, and no next packet on this page either.
|
//Okay, there's no next page yet, and no next packet on this page either.
|
||||||
//That means we're waiting for data to show up, somewhere.
|
//That means we're waiting for data to show up, somewhere.
|
||||||
// after ~25 seconds, give up and drop the track.
|
// after ~25 seconds, give up and drop the track.
|
||||||
if (++emptyCount >= 1000){
|
if (++emptyCount >= 2500){
|
||||||
dropTrack(nxt.tid, "EOP: data wait timeout");
|
dropTrack(nxt.tid, "EOP: data wait timeout");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//every ~1 second, check if the stream is not offline
|
//every ~1 second, check if the stream is not offline
|
||||||
if (emptyCount % 40 == 0 && M.getLive() && Util::getStreamStatus(streamName) == STRMSTAT_OFF){
|
if (emptyCount % 100 == 0 && M.getLive() && Util::getStreamStatus(streamName) == STRMSTAT_OFF){
|
||||||
Util::logExitReason("Stream source shut down");
|
Util::logExitReason("Stream source shut down");
|
||||||
thisPacket.null();
|
thisPacket.null();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//every ~16 seconds, reconnect to metadata
|
//every ~16 seconds, reconnect to metadata
|
||||||
if (emptyCount % 640 == 0){
|
if (emptyCount % 1600 == 0){
|
||||||
reconnect();
|
reconnect();
|
||||||
if (!meta){
|
if (!meta){
|
||||||
onFail("Could not connect to stream data", true);
|
onFail("Could not connect to stream data", true);
|
||||||
|
@ -1503,7 +1504,7 @@ namespace Mist{
|
||||||
return false;//no sleep after reconnect
|
return false;//no sleep after reconnect
|
||||||
}
|
}
|
||||||
//Fine! We didn't want a packet, anyway. Let's try again later.
|
//Fine! We didn't want a packet, anyway. Let's try again later.
|
||||||
Util::sleep(25);
|
playbackSleep(10);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue