Some minor optimizes to HDS fragment list generation.

This commit is contained in:
Thulinma 2014-12-13 21:21:20 +01:00
parent 2e48687e8e
commit 70ba531ba9

View file

@ -56,20 +56,22 @@ namespace Mist {
int i = 0; int i = 0;
int j = 0; int j = 0;
if (myMeta.tracks[tid].fragments.size()){ if (myMeta.tracks[tid].fragments.size()){
unsigned int firstTime = myMeta.tracks[tid].getKey(myMeta.tracks[tid].fragments.begin()->getNumber()).getTime(); std::deque<DTSC::Fragment>::iterator fragIt = myMeta.tracks[tid].fragments.begin();
for (std::deque<DTSC::Fragment>::iterator it = myMeta.tracks[tid].fragments.begin(); it != myMeta.tracks[tid].fragments.end(); it++){ unsigned int firstTime = myMeta.tracks[tid].getKey(fragIt->getNumber()).getTime();
if (myMeta.vod || it->getDuration() > 0){ while (fragIt != myMeta.tracks[tid].fragments.end()){
if (myMeta.vod || fragIt->getDuration() > 0){
afrtrun.firstFragment = myMeta.tracks[tid].missedFrags + j + 1; afrtrun.firstFragment = myMeta.tracks[tid].missedFrags + j + 1;
afrtrun.firstTimestamp = myMeta.tracks[tid].getKey(it->getNumber()).getTime() - firstTime; afrtrun.firstTimestamp = myMeta.tracks[tid].getKey(fragIt->getNumber()).getTime() - firstTime;
if (it->getDuration() > 0){ if (fragIt->getDuration() > 0){
afrtrun.duration = it->getDuration(); afrtrun.duration = fragIt->getDuration();
}else{ }else{
afrtrun.duration = myMeta.tracks[tid].lastms - afrtrun.firstTimestamp; afrtrun.duration = myMeta.tracks[tid].lastms - afrtrun.firstTimestamp;
} }
afrt.setFragmentRun(afrtrun, i); afrt.setFragmentRun(afrtrun, i);
i++; ++i;
} }
j++; ++j;
++fragIt;
} }
} }