Speed optimizes:
- MP4 output optimizations - DTSC::Meta::getPageNumberForTime speedup - RelAccX class speedup - Generic output optimizations
This commit is contained in:
parent
b8ba101a55
commit
027bd5f9da
8 changed files with 339 additions and 169 deletions
|
@ -1482,18 +1482,6 @@ namespace Mist{
|
|||
return false;
|
||||
}
|
||||
|
||||
if (M.getPageNumberForTime(nxt.tid, nxt.time) != currentPage[nxt.tid]){
|
||||
loadPageForKey(nxt.tid, M.getPageNumberForTime(nxt.tid, nxt.time));
|
||||
nxt.offset = 0;
|
||||
//Only read the next time if the page load succeeded and there is a packet to read from
|
||||
if (curPage[nxt.tid].mapped && curPage[nxt.tid].mapped[0] == 'D'){
|
||||
nxt.time = getDTSCTime(curPage[nxt.tid].mapped, 0);
|
||||
}
|
||||
buffer.erase(buffer.begin());
|
||||
buffer.insert(nxt);
|
||||
return false;
|
||||
}
|
||||
|
||||
// if we're going to read past the end of the data page, load the next page
|
||||
// this only happens for VoD
|
||||
if (nxt.offset >= curPage[nxt.tid].len ||
|
||||
|
@ -1502,6 +1490,17 @@ namespace Mist{
|
|||
dropTrack(nxt.tid, "end of VoD track reached", false);
|
||||
return false;
|
||||
}
|
||||
if (M.getPageNumberForTime(nxt.tid, nxt.time) != currentPage[nxt.tid]){
|
||||
loadPageForKey(nxt.tid, M.getPageNumberForTime(nxt.tid, nxt.time));
|
||||
nxt.offset = 0;
|
||||
//Only read the next time if the page load succeeded and there is a packet to read from
|
||||
if (curPage[nxt.tid].mapped && curPage[nxt.tid].mapped[0] == 'D'){
|
||||
nxt.time = getDTSCTime(curPage[nxt.tid].mapped, 0);
|
||||
}
|
||||
buffer.erase(buffer.begin());
|
||||
buffer.insert(nxt);
|
||||
return false;
|
||||
}
|
||||
dropTrack(nxt.tid, "VoD page load failure");
|
||||
return false;
|
||||
}
|
||||
|
@ -1511,9 +1510,6 @@ namespace Mist{
|
|||
|
||||
uint64_t nextTime = 0;
|
||||
|
||||
DTSC::Keys keys(M.keys(nxt.tid));
|
||||
size_t thisKey = keys.getNumForTime(nxt.time);
|
||||
|
||||
// Check if we have a next valid packet
|
||||
if (curPage[nxt.tid].len > nxt.offset+preLoad.getDataLen()+20 && memcmp(curPage[nxt.tid].mapped + nxt.offset + preLoad.getDataLen(), "\000\000\000\000", 4)){
|
||||
nextTime = getDTSCTime(curPage[nxt.tid].mapped, nxt.offset + preLoad.getDataLen());
|
||||
|
@ -1531,6 +1527,8 @@ namespace Mist{
|
|||
dropTrack(nxt.tid, "end of VoD track reached", false);
|
||||
return true;
|
||||
}
|
||||
DTSC::Keys keys(M.keys(nxt.tid));
|
||||
size_t thisKey = keys.getNumForTime(nxt.time);
|
||||
//Check if there exists a different page for the next key
|
||||
size_t nextKeyPage = M.getPageNumberForKey(nxt.tid, thisKey + 1);
|
||||
if (nextKeyPage != INVALID_KEY_NUM && nextKeyPage != currentPage[nxt.tid]){
|
||||
|
@ -1594,13 +1592,19 @@ namespace Mist{
|
|||
return false;
|
||||
}
|
||||
|
||||
//Update keynum only when the second flips over in the timestamp
|
||||
//We do this because DTSC::Keys is pretty CPU-heavy
|
||||
if (nxt.time / 1000 < nextTime/1000){
|
||||
DTSC::Keys keys(M.keys(nxt.tid));
|
||||
size_t thisKey = keys.getNumForTime(nxt.time);
|
||||
userSelect[nxt.tid].setKeyNum(thisKey);
|
||||
}
|
||||
|
||||
// we assume the next packet is the next on this same page
|
||||
nxt.offset += thisPacket.getDataLen();
|
||||
nxt.time = nextTime;
|
||||
++nxt.partIndex;
|
||||
|
||||
userSelect[nxt.tid].setKeyNum(thisKey);
|
||||
|
||||
// exchange the current packet in the buffer for the next one
|
||||
buffer.erase(buffer.begin());
|
||||
buffer.insert(nxt);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue