Added some helpful high-level debug messages to generic IO handlers, fixed missing track selection when streaming live input

This commit is contained in:
Thulinma 2018-07-13 23:17:47 +02:00
parent e00e10b3ad
commit fe7cee8666
3 changed files with 9 additions and 4 deletions

View file

@ -559,6 +559,7 @@ 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++){
it->second.firstms = 0; it->second.firstms = 0;
it->second.lastms = 0; it->second.lastms = 0;
selectedTracks.insert(it->first);
} }
std::string reason = streamMainLoop(); std::string reason = streamMainLoop();
@ -821,6 +822,7 @@ namespace Mist {
getNext(); getNext();
//in case earlier seeking was inprecise, seek to the exact point //in case earlier seeking was inprecise, seek to the exact point
while (thisPacket && thisPacket.getTime() < (unsigned long long)myMeta.tracks[track].keys[keyNum - 1].getTime()) { while (thisPacket && thisPacket.getTime() < (unsigned long long)myMeta.tracks[track].keys[keyNum - 1].getTime()) {
DONTEVEN_MSG("Skipping packet: %d@%llu, %llub", track, thisPacket.getTime(), thisPacket.getDataLen());
getNext(); getNext();
} }
} }
@ -840,6 +842,7 @@ namespace Mist {
}else{ }else{
while (thisPacket && thisPacket.getTime() < stopTime) { while (thisPacket && thisPacket.getTime() < stopTime) {
if (thisPacket.getTime() >= lastBuffered){ if (thisPacket.getTime() >= lastBuffered){
DONTEVEN_MSG("Buffering packet: %d@%llu, %llub", track, thisPacket.getTime(), thisPacket.getDataLen());
bufferNext(thisPacket); bufferNext(thisPacket);
++packCounter; ++packCounter;
byteCounter += thisPacket.getDataLen(); byteCounter += thisPacket.getDataLen();
@ -850,7 +853,7 @@ namespace Mist {
} }
bufferFinalize(track); bufferFinalize(track);
bufferTimer = Util::bootMS() - bufferTimer; bufferTimer = Util::bootMS() - bufferTimer;
DEBUG_MSG(DLVL_DEVEL, "Done buffering page %d (%llu packets, %llu bytes, %llu-%llums) for track %d (%s) in %llums", keyNum, packCounter, byteCounter, myMeta.tracks[track].keys[keyNum - 1].getTime(), stopTime, track, myMeta.tracks[track].codec.c_str(), bufferTimer); DEBUG_MSG(DLVL_DEVEL, "Done buffering page %d (%llu packets, %llu bytes, %llu-%llums -> %llums) for track %d (%s) in %llums", keyNum, packCounter, byteCounter, myMeta.tracks[track].keys[keyNum - 1].getTime(), stopTime, lastBuffered, track, myMeta.tracks[track].codec.c_str(), bufferTimer);
pageCounter[track][keyNum] = 15; pageCounter[track][keyNum] = 15;
return true; return true;
} }

View file

@ -337,7 +337,7 @@ namespace Mist {
size_t curOffset = pageData.curOffset; size_t curOffset = pageData.curOffset;
//Do nothing when there is not enough free space on the page to add the packet. //Do nothing when there is not enough free space on the page to add the packet.
if (pageData.dataSize - curOffset < pack.getDataLen()) { if (pageData.dataSize - curOffset < pack.getDataLen()) {
FAIL_MSG("Trying to buffer a packet on page %lu for track %lu~>%lu, but we have a size mismatch. The packet is %d bytes long, so won't fit at offset %lu on a page of %llu bytes!", curPageNum[tid], tid, mapTid, pack.getDataLen(), curOffset, pageData.dataSize); FAIL_MSG("Trying to buffer a packet (%llums) on page %lu for track %lu~>%lu, but we have a size mismatch. The packet is %d bytes long, so won't fit at offset %lu on a page of %llu bytes!", pack.getTime(), curPageNum[tid], tid, mapTid, pack.getDataLen(), curOffset, pageData.dataSize);
return; return;
} }

View file

@ -1365,10 +1365,12 @@ namespace Mist{
loadPageForKey(nxt.tid, ++nxtKeyNum[nxt.tid]); loadPageForKey(nxt.tid, ++nxtKeyNum[nxt.tid]);
nxt.offset = 0; nxt.offset = 0;
if (nProxy.curPage.count(nxt.tid) && nProxy.curPage[nxt.tid].mapped){ if (nProxy.curPage.count(nxt.tid) && nProxy.curPage[nxt.tid].mapped){
if (getDTSCTime(nProxy.curPage[nxt.tid].mapped, nxt.offset) < nxt.time){ uint64_t newTime = getDTSCTime(nProxy.curPage[nxt.tid].mapped, nxt.offset);
VERYHIGH_MSG("New page %llu for track %llu, first timestamp is %llu ms", nxtKeyNum[nxt.tid], nxt.tid, newTime);
if (newTime < nxt.time){
dropTrack(nxt.tid, "time going backwards"); dropTrack(nxt.tid, "time going backwards");
}else{ }else{
nxt.time = getDTSCTime(nProxy.curPage[nxt.tid].mapped, nxt.offset); nxt.time = newTime;
//swap out the next object in the buffer with a new one //swap out the next object in the buffer with a new one
buffer.erase(buffer.begin()); buffer.erase(buffer.begin());
buffer.insert(nxt); buffer.insert(nxt);