Changed buffer full/empty behaviour to trigger at 3 segments instead of 50% of buffer size.

This commit is contained in:
Thulinma 2015-12-24 20:16:36 +01:00
parent b6f03a4591
commit a6ef31d1ea
2 changed files with 26 additions and 17 deletions

View file

@ -164,14 +164,13 @@ namespace Mist {
snprintf(lineBuf, 400, "#EXTINF:%lld, no desc\r\n%lld_%lld,ts\r\n", ((duration + 500) / 1000), starttime, starttime + duration);
lines.push_back(lineBuf);
}
//skip the first fragment if live and there are more than 2 fragments.
unsigned int skippedLines = 0;
if (myMeta.live) {
//only print the last segment when VoD
lines.pop_back();
/*LTS-START*/
unsigned int skip = ((myMeta.tracks[tid].fragments.size() - 1) * config->getInteger("startpos")) / 1000u;
while (skippedLines < skip && lines.size()) {
unsigned int skip = (( myMeta.tracks[tid].fragments.size()-1) * config->getInteger("startpos")) / 1000u;
while (skippedLines < skip && lines.size() >= 3){
lines.pop_front();
skippedLines++;
}
@ -297,16 +296,15 @@ namespace Mist {
if (!myMeta.tracks.size()) {
return 1;
}
//loop trough all the tracks
for (std::map<unsigned int, DTSC::Track>::iterator it = myMeta.tracks.begin(); it != myMeta.tracks.end(); it++) {
//return "too late" if one track is past this point
if (ms < it->second.firstms) {
return -1;
}
//return "too early" if one track is not yet at this point
if (ms > it->second.lastms) {
return 1;
}
//check main track
DTSC::Track & mainTrack = myMeta.tracks[*selectedTracks.begin()];
//return "too late" if one track is past this point
if (ms < mainTrack.firstms){
return -1;
}
//return "too early" if one track is not yet at this point
if (ms > mainTrack.lastms){
return 1;
}
return 0;
}