Improved track removal timings.

This commit is contained in:
Thulinma 2015-09-04 17:24:28 +02:00
parent 2222a37079
commit 0e55b66e7d

View file

@ -193,13 +193,19 @@ 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 ((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))) { if ((long long int)(time - lastUpdated[it->first]) > (long long int)(bufferTime / 1000) ||
(compareLast && (long long int)(time - lastUpdated[it->first]) > 5 && (
(compareLast < it->second.firstms && (long long int)(it->second.firstms - compareLast) > bufferTime)
||
(compareFirst > it->second.lastms && (long long int)(compareFirst - it->second.lastms) > bufferTime)
))
){
unsigned int tid = it->first; unsigned int tid = it->first;
//erase this track //erase this track
if ((time - lastUpdated[it->first]) > (bufferTime / 1000)){ if ((long long int)(time - lastUpdated[it->first]) > (long long int)(bufferTime / 1000)){
INFO_MSG("Erasing track %d because not updated for %ds (> %ds)", it->first, (time - lastUpdated[it->first]), bufferTime / 1000); INFO_MSG("Erasing track %d because not updated for %ds (> %ds)", it->first, (long long int)(time - lastUpdated[it->first]), (long long int)(bufferTime / 1000));
}else{ }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); INFO_MSG("Erasing 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.", it->first, it->second.firstms / 1000, it->second.lastms / 1000, compareFirst/1000, compareLast/1000, bufferTime / 1000);
} }
lastUpdated.erase(tid); lastUpdated.erase(tid);
/// \todo Consider replacing with eraseTrackDataPages(it->first)? /// \todo Consider replacing with eraseTrackDataPages(it->first)?