Pro side of HLS buffer size optimizes.
This commit is contained in:
parent
8c8e47ad20
commit
42e0b4b8ef
1 changed files with 2 additions and 15 deletions
|
@ -95,22 +95,9 @@ namespace Mist {
|
|||
|
||||
std::string OutHLS::pushLiveIndex(int tid, unsigned long bTime, unsigned long eTime){
|
||||
updateMeta();
|
||||
if (!myMeta.tracks[tid].fragments.size()) {
|
||||
INFO_MSG("liveIndex called with track %d, which has no fragments!", tid);
|
||||
return "";
|
||||
}
|
||||
std::stringstream result;
|
||||
//parse single track
|
||||
int longestFragment = 0;
|
||||
for (std::deque<DTSC::Fragment>::iterator it = myMeta.tracks[tid].fragments.begin(); (it + 1) != myMeta.tracks[tid].fragments.end(); it++) {
|
||||
if (it->getDuration() > longestFragment) {
|
||||
longestFragment = it->getDuration();
|
||||
}
|
||||
}
|
||||
if ((myMeta.tracks[tid].lastms - myMeta.tracks[tid].firstms) / myMeta.tracks[tid].fragments.size() > longestFragment) {
|
||||
longestFragment = (myMeta.tracks[tid].lastms - myMeta.tracks[tid].firstms) / myMeta.tracks[tid].fragments.size();
|
||||
}
|
||||
result << "#EXTM3U\r\n#EXT-X-TARGETDURATION:" << (longestFragment / 1000) + 1 << "\r\n";
|
||||
result << "#EXTM3U\r\n#EXT-X-TARGETDURATION:" << (myMeta.tracks[tid].biggestFragment() / 1000) + 1 << "\r\n";
|
||||
|
||||
std::deque<std::string> lines;
|
||||
unsigned int skippedLines = 0;
|
||||
|
@ -183,7 +170,7 @@ namespace Mist {
|
|||
lines.pop_back();
|
||||
/*LTS-START*/
|
||||
unsigned int skip = (( myMeta.tracks[tid].fragments.size()-1) * config->getInteger("startpos")) / 1000u;
|
||||
while (skippedLines < skip && lines.size() > 3){
|
||||
while (skippedLines < skip && lines.size() > 4){
|
||||
lines.pop_front();
|
||||
skippedLines++;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue