Change "always on" behaviour to simulate always having viewers rather than forcibly keeping inputs active

This commit is contained in:
Marco van Dijk 2023-06-22 11:00:21 +02:00 committed by Thulinma
parent b3a0e28159
commit e0eb624e53
3 changed files with 9 additions and 8 deletions

View file

@ -1683,13 +1683,13 @@ namespace DTSC{
trackLock.open(pageName, O_CREAT | O_RDWR, ACCESSPERMS, 1); trackLock.open(pageName, O_CREAT | O_RDWR, ACCESSPERMS, 1);
if (!trackLock){ if (!trackLock){
FAIL_MSG("Could not open semaphore to add track!"); FAIL_MSG("Could not open semaphore to add track!");
return -1; return INVALID_TRACK_ID;
} }
trackLock.wait(); trackLock.wait();
if (stream.isExit()){ if (stream.isExit()){
trackLock.post(); trackLock.post();
FAIL_MSG("Not adding track: stream is shutting down"); FAIL_MSG("Not adding track: stream is shutting down");
return -1; return INVALID_TRACK_ID;
} }
} }

View file

@ -511,6 +511,11 @@ namespace SDP{
nope = true; nope = true;
tid = myMeta->addTrack(); tid = myMeta->addTrack();
if (tid == INVALID_TRACK_ID){
WARN_MSG("Could not add new track, skipping");
continue;
}
// Strip m= // Strip m=
std::stringstream words(to.substr(2)); std::stringstream words(to.substr(2));
std::string item; std::string item;

View file

@ -761,7 +761,7 @@ namespace Mist{
uint64_t currLastUpdate = M.getLastUpdated(); uint64_t currLastUpdate = M.getLastUpdated();
if (currLastUpdate > activityCounter){activityCounter = currLastUpdate;} if (currLastUpdate > activityCounter){activityCounter = currLastUpdate;}
}else{ }else{
if (connectedUsers && M.getValidTracks().size()){activityCounter = Util::bootSecs();} if ((connectedUsers || isAlwaysOn()) && M.getValidTracks().size()){activityCounter = Util::bootSecs();}
} }
inputServeStats(); inputServeStats();
@ -813,10 +813,6 @@ namespace Mist{
// - INPUT_TIMEOUT seconds haven't passed yet, // - INPUT_TIMEOUT seconds haven't passed yet,
// - this is a live stream and at least two of the biggest fragment haven't passed yet, // - this is a live stream and at least two of the biggest fragment haven't passed yet,
bool ret = config->is_active && ((Util::bootSecs() - activityCounter) < INPUT_TIMEOUT); bool ret = config->is_active && ((Util::bootSecs() - activityCounter) < INPUT_TIMEOUT);
if (!ret && config->is_active && isAlwaysOn()){
ret = true;
activityCounter = Util::bootSecs();
}
/*LTS-START*/ /*LTS-START*/
if (!ret){ if (!ret){
if (Triggers::shouldTrigger("STREAM_UNLOAD", config->getString("streamname"))){ if (Triggers::shouldTrigger("STREAM_UNLOAD", config->getString("streamname"))){
@ -1489,7 +1485,7 @@ namespace Mist{
for (size_t i = 0; i < keyNum; ++i){partNo += keys.getParts(i);} for (size_t i = 0; i < keyNum; ++i){partNo += keys.getParts(i);}
DTSC::Parts parts(M.parts(idx)); DTSC::Parts parts(M.parts(idx));
while (thisPacket && thisTime < stopTime){ while (thisPacket && thisTime < stopTime){
if (connectedUsers){activityCounter = Util::bootSecs();} if (connectedUsers || isAlwaysOn()){activityCounter = Util::bootSecs();}
if (thisTime >= lastBuffered){ if (thisTime >= lastBuffered){
if (sourceIdx != idx){ if (sourceIdx != idx){
if (encryption.find(":") != std::string::npos || M.getEncryption(idx).find(":") != std::string::npos){ if (encryption.find(":") != std::string::npos || M.getEncryption(idx).find(":") != std::string::npos){