Improvements to track negotiation timings and debug message verbosity.
This commit is contained in:
parent
97b8adf41e
commit
2222a37079
2 changed files with 14 additions and 10 deletions
|
@ -196,8 +196,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);
|
||||
|
@ -386,8 +391,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.
|
||||
|
|
13
src/io.cpp
13
src/io.cpp
|
@ -436,14 +436,13 @@ namespace Mist {
|
|||
metaPages[tid].master = false;
|
||||
return;
|
||||
}
|
||||
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
|
||||
if (trackState.count(tid) && (trackState[tid] == FILL_DEC || trackState[tid] == FILL_ACC)) {
|
||||
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
|
||||
|
@ -490,7 +489,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);
|
||||
|
@ -502,7 +501,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);
|
||||
|
@ -517,7 +516,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)
|
||||
|
@ -542,7 +541,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;
|
||||
|
|
Loading…
Add table
Reference in a new issue