Merge branch 'development' into LTS_development

This commit is contained in:
Thulinma 2015-09-04 10:12:45 +02:00
commit bb7dcd8f2a
2 changed files with 14 additions and 10 deletions

View file

@ -313,8 +313,13 @@ namespace Mist {
if ((time - lastUpdated[it->first]) > (bufferTime / 1000) || (compareLast && (time - lastUpdated[it->first]) > 5 && ((myMeta.tracks[it->first].firstms - compareLast) > bufferTime || (compareFirst - myMeta.tracks[it->first].lastms) > bufferTime))){
unsigned int tid = it->first;
//erase this track
INFO_MSG("Erasing track %d because of timeout", it->first);
if ((time - lastUpdated[it->first]) > (bufferTime / 1000)){
INFO_MSG("Erasing track %d because not updated for %ds (> %ds)", it->first, (time - lastUpdated[it->first]), bufferTime / 1000);
}else{
INFO_MSG("Erasing inactive track %d because it contains data (%ds - %ds), while active tracks are (%ds - %ds), which is more than %ds seconds apart.", it->second.firstms / 1000, it->second.lastms / 1000, compareFirst/1000, compareLast/1000, bufferTime / 1000);
}
lastUpdated.erase(tid);
/// \todo Consider replacing with eraseTrackDataPages(it->first)?
while (bufferLocations[tid].size()){
char thisPageName[NAME_BUFFER_SIZE];
snprintf(thisPageName, NAME_BUFFER_SIZE, SHM_TRACK_DATA, config->getString("streamname").c_str(), (unsigned long)tid, bufferLocations[tid].begin()->first);
@ -530,8 +535,8 @@ namespace Mist {
//Register the new track as an active track.
activeTracks.insert(finalMap);
//Register the time of registration as initial value for the lastUpdated field.
lastUpdated[finalMap] = Util::bootSecs();
//Register the time of registration as initial value for the lastUpdated field, plus an extra 5 seconds just to be sure.
lastUpdated[finalMap] = Util::bootSecs() + 5;
//Register the user thats is pushing this element
pushLocation[finalMap] = data;
//Initialize the metadata for this track if it was not in place yet.

View file

@ -509,14 +509,13 @@ namespace Mist {
metaPages[tid].master = false;
return;
}
//dont try to re-negoiate existing tracks, if this is what you want, remove the tid from the trackState before calling this function
if (trackState.count(tid) && (trackState[tid] == FILL_DEC || trackState[tid] == FILL_ACC)) {
HIGH_MSG("Do Not Renegotiate");
//dont try to re-negoiate existing tracks, if this is what you want, remove the tid from the trackState before calling this function
return;
}
if (!trackOffset.count(tid)) {
if (trackOffset.size() > SIMUL_TRACKS) {
INFO_MSG("Trackoffset too high");
WARN_MSG("Trackoffset too high");
return;
}
//Find a free offset for the new track
@ -563,7 +562,7 @@ namespace Mist {
INSANE_MSG("Breaking because not set yet");
break;
}
INFO_MSG("Track %lu temporarily mapped to %lu", tid, newTid);
HIGH_MSG("Track %lu temporarily mapped to %lu", tid, newTid);
char pageName[NAME_BUFFER_SIZE];
snprintf(pageName, NAME_BUFFER_SIZE, SHM_TRACK_META, streamName.c_str(), newTid);
@ -575,7 +574,7 @@ namespace Mist {
JSON::Value tmpVal = tmpMeta.toJSON();
std::string tmpStr = tmpVal.toNetPacked();
memcpy(metaPages[tid].mapped, tmpStr.data(), tmpStr.size());
INFO_MSG("Temporary metadata written for incoming track %lu, handling as track %lu", tid, newTid);
HIGH_MSG("Temporary metadata written for incoming track %lu, handling as track %lu", tid, newTid);
//Not actually removing the page, because we set master to false
#if defined(__CYGWIN__) || defined(_WIN32)
IPC::preservePage(pageName);
@ -590,7 +589,7 @@ namespace Mist {
unsigned long finalTid = ((long)(tmp[offset]) << 24) | ((long)(tmp[offset + 1]) << 16) | ((long)(tmp[offset + 2]) << 8) | tmp[offset + 3];
unsigned long firstPage = firstPage = ((long)(tmp[offset + 4]) << 8) | tmp[offset + 5];
if (firstPage == 0xFFFF) {
INFO_MSG("Negotiating, but firstPage not yet set, waiting for buffer");
HIGH_MSG("Negotiating, but firstPage not yet set, waiting for buffer");
break;
}
#if defined(__CYGWIN__) || defined(_WIN32)
@ -615,7 +614,7 @@ namespace Mist {
break;
}
INFO_MSG("Buffer has indicated that incoming track %lu should start writing on track %lu, page %lu", tid, finalTid, firstPage);
MEDIUM_MSG("Buffer has indicated that incoming track %lu should start writing on track %lu, page %lu", tid, finalTid, firstPage);
trackMap[tid] = finalTid;
if (myMeta.tracks.count(finalTid) && myMeta.tracks[finalTid].lastms){
myMeta.tracks[finalTid].lastms = 0;