Only drop 5s inactive tracks if they have been replaced by a track of the same type that is active.
This commit is contained in:
parent
9e245c2b51
commit
e95aa4f3b6
1 changed files with 5 additions and 3 deletions
|
@ -392,11 +392,13 @@ namespace Mist {
|
||||||
long long unsigned int time = Util::bootSecs();
|
long long unsigned int time = Util::bootSecs();
|
||||||
long long unsigned int compareFirst = 0xFFFFFFFFFFFFFFFFull;
|
long long unsigned int compareFirst = 0xFFFFFFFFFFFFFFFFull;
|
||||||
long long unsigned int compareLast = 0;
|
long long unsigned int compareLast = 0;
|
||||||
|
std::set<std::string> activeTypes;
|
||||||
//for tracks that were updated in the last 5 seconds, get the first and last ms edges.
|
//for tracks that were updated in the last 5 seconds, get the first and last ms edges.
|
||||||
for (std::map<unsigned int, DTSC::Track>::iterator it2 = myMeta.tracks.begin(); it2 != myMeta.tracks.end(); it2++) {
|
for (std::map<unsigned int, DTSC::Track>::iterator it2 = myMeta.tracks.begin(); it2 != myMeta.tracks.end(); it2++) {
|
||||||
if ((time - lastUpdated[it2->first]) > 5) {
|
if ((time - lastUpdated[it2->first]) > 5) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
activeTypes.insert(it2->second.type);
|
||||||
if (it2->second.lastms > compareLast) {
|
if (it2->second.lastms > compareLast) {
|
||||||
compareLast = it2->second.lastms;
|
compareLast = it2->second.lastms;
|
||||||
}
|
}
|
||||||
|
@ -407,7 +409,7 @@ namespace Mist {
|
||||||
for (std::map<unsigned int, DTSC::Track>::iterator it = myMeta.tracks.begin(); it != myMeta.tracks.end(); it++) {
|
for (std::map<unsigned int, DTSC::Track>::iterator it = myMeta.tracks.begin(); it != myMeta.tracks.end(); it++) {
|
||||||
//if not updated for an entire buffer duration, or last updated track and this track differ by an entire buffer duration, erase the track.
|
//if not updated for an entire buffer duration, or last updated track and this track differ by an entire buffer duration, erase the track.
|
||||||
if ((long long int)(time - lastUpdated[it->first]) > (long long int)(bufferTime / 1000) ||
|
if ((long long int)(time - lastUpdated[it->first]) > (long long int)(bufferTime / 1000) ||
|
||||||
(compareLast && (long long int)(time - lastUpdated[it->first]) > 5 && (
|
(compareLast && activeTypes.count(it->second.type) && (long long int)(time - lastUpdated[it->first]) > 5 && (
|
||||||
(compareLast < it->second.firstms && (long long int)(it->second.firstms - compareLast) > bufferTime)
|
(compareLast < it->second.firstms && (long long int)(it->second.firstms - compareLast) > bufferTime)
|
||||||
||
|
||
|
||||||
(compareFirst > it->second.lastms && (long long int)(compareFirst - it->second.lastms) > bufferTime)
|
(compareFirst > it->second.lastms && (long long int)(compareFirst - it->second.lastms) > bufferTime)
|
||||||
|
@ -416,9 +418,9 @@ namespace Mist {
|
||||||
unsigned int tid = it->first;
|
unsigned int tid = it->first;
|
||||||
//erase this track
|
//erase this track
|
||||||
if ((long long int)(time - lastUpdated[it->first]) > (long long int)(bufferTime / 1000)) {
|
if ((long long int)(time - lastUpdated[it->first]) > (long long int)(bufferTime / 1000)) {
|
||||||
WARN_MSG("Erasing %s track %d because not updated for %ds (> %ds)", streamName.c_str(), it->first, (long long int)(time - lastUpdated[it->first]), (long long int)(bufferTime / 1000));
|
WARN_MSG("Erasing %s track %d (%s/%s) because not updated for %ds (> %ds)", streamName.c_str(), it->first, it->second.type.c_str(), it->second.codec.c_str(), (long long int)(time - lastUpdated[it->first]), (long long int)(bufferTime / 1000));
|
||||||
} else {
|
} else {
|
||||||
WARN_MSG("Erasing %s inactive track %u because it was inactive for 5+ seconds and contains data (%us - %us), while active tracks are (%us - %us), which is more than %us seconds apart.", streamName.c_str(), it->first, it->second.firstms / 1000, it->second.lastms / 1000, compareFirst / 1000, compareLast / 1000, bufferTime / 1000);
|
WARN_MSG("Erasing %s inactive track %u (%s/%s) because it was inactive for 5+ seconds and contains data (%us - %us), while active tracks are (%us - %us), which is more than %us seconds apart.", streamName.c_str(), it->first, it->second.type.c_str(), it->second.codec.c_str(), it->second.firstms / 1000, it->second.lastms / 1000, compareFirst / 1000, compareLast / 1000, bufferTime / 1000);
|
||||||
}
|
}
|
||||||
/*LTS-START*/
|
/*LTS-START*/
|
||||||
if (Triggers::shouldTrigger("STREAM_TRACK_REMOVE")) {
|
if (Triggers::shouldTrigger("STREAM_TRACK_REMOVE")) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue