Backported various Pro edition changes and general code to Free edition

This commit is contained in:
Thulinma 2018-10-11 17:51:35 +02:00
parent 2aa86ccf01
commit 776cfe1850
7 changed files with 123 additions and 91 deletions

View file

@ -263,6 +263,7 @@ namespace Mist {
///Checks in the server configuration if this stream is set to always on or not.
/// Returns true if it is, or if the stream could not be found in the configuration.
/// If the compiled default debug level is < INFO, instead returns false if the stream is not found.
bool Input::isAlwaysOn(){
bool ret = true;
std::string strName = streamName.substr(0, (streamName.find_first_of("+ ")));
@ -274,6 +275,10 @@ namespace Mist {
if (!streamCfg.getMember("always_on") || !streamCfg.getMember("always_on").asBool()){
ret = false;
}
}else{
#if DEBUG < DLVL_DEVEL
ret = false;
#endif
}
configLock.post();
return ret;
@ -331,6 +336,10 @@ namespace Mist {
// - INPUT_TIMEOUT seconds 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 || (myMeta.live && (Util::bootSecs() - activityCounter) < myMeta.biggestFragment()/500)));
if (!ret && config->is_active && isAlwaysOn()){
ret = true;
activityCounter = Util::bootSecs();
}
return ret;
}
@ -473,12 +482,6 @@ namespace Mist {
if (!it2->second){
bufferRemove(it->first, it2->first);
pageCounter[it->first].erase(it2->first);
for (int i = 0; i < 8192; i += 8){
unsigned int thisKeyNum = ntohl(((((long long int *)(nProxy.metaPages[it->first].mapped + i))[0]) >> 32) & 0xFFFFFFFF);
if (thisKeyNum == it2->first){
(((long long int *)(nProxy.metaPages[it->first].mapped + i))[0]) = 0;
}
}
change = true;
break;
}

View file

@ -351,6 +351,19 @@ namespace Mist {
bufferLocations[tid].erase(bufferLocations[tid].begin());
}
if (pushLocation.count(it->first)){
// \todo Debugger says this is null sometimes. It shouldn't be. Figure out why!
// For now, this if will prevent crashes in these cases.
if (pushLocation[it->first]){
//Reset the userpage, to allow repushing from TS
IPC::userConnection userConn(pushLocation[it->first]);
for (int i = 0; i < SIMUL_TRACKS; i++) {
if (userConn.getTrackId(i) == it->first) {
userConn.setTrackId(i, 0);
userConn.setKeynum(i, 0);
break;
}
}
}
pushLocation.erase(it->first);
}
nProxy.curPageNum.erase(it->first);