Fixed seeking when seeking to a timestamp right before a keyframe right after a memory page switch. Also made MP4 progressive output more reliable, improved timers and debugging message clarity.

This commit is contained in:
Thulinma 2014-12-16 11:54:12 +01:00
parent da612d03b6
commit 9132d38ac0
2 changed files with 20 additions and 8 deletions

View file

@ -367,8 +367,15 @@ namespace Mist {
return 0;
}
unsigned int keyNo = trk.keys.begin()->getNumber();
for (std::deque<DTSC::Key>::iterator it = trk.keys.begin(); it != trk.keys.end() && it->getTime() <= timeStamp; it++){
unsigned int partCount = 0;
std::deque<DTSC::Key>::iterator it;
for (it = trk.keys.begin(); it != trk.keys.end() && it->getTime() <= timeStamp; it++){
keyNo = it->getNumber();
partCount += it->getParts();
}
//if the time is before the next keyframe but after the last part, correctly seek to next keyframe
if (partCount && it != trk.keys.end() && timeStamp > it->getTime() - trk.parts[partCount-1].getDuration()){
++keyNo;
}
return keyNo;
}
@ -481,10 +488,10 @@ namespace Mist {
if (curPages[tid].mapped[tmp.offset] != 0){
DEBUG_MSG(DLVL_FAIL, "Noes! Couldn't find packet on track %d because of some kind of corruption error or somesuch.", tid);
}else{
DEBUG_MSG(DLVL_FAIL, "Track %d no data (key %u) - waiting...", tid, getKeyForTime(tid, pos) + (getNextKey?1:0));
DEBUG_MSG(DLVL_FAIL, "Track %d no data (key %u @ %u) - waiting...", tid, getKeyForTime(tid, pos) + (getNextKey?1:0), tmp.offset);
unsigned int i = 0;
while (curPages[tid].mapped[tmp.offset] == 0 && ++i < 10){
Util::sleep(100);
while (curPages[tid].mapped[tmp.offset] == 0 && ++i < 42){
Util::wait(100);
}
if (curPages[tid].mapped[tmp.offset] == 0){
DEBUG_MSG(DLVL_FAIL, "Track %d no data (key %u) - timeout", tid, getKeyForTime(tid, pos) + (getNextKey?1:0));
@ -741,4 +748,3 @@ namespace Mist {
}
}

View file

@ -496,10 +496,16 @@ namespace Mist {
unsigned int len = 0;
currentPacket.getString("data", dataPointer, len);
if ((unsigned long)currentPacket.getTrackId() != sortSet.begin()->trackID || currentPacket.getTime() != sortSet.begin()->time){
if (currentPacket.getTime() >= sortSet.begin()->time || (unsigned long)currentPacket.getTrackId() >= sortSet.begin()->trackID){
if (perfect){
DEBUG_MSG(DLVL_WARN, "Warning: input is inconsistent. Expected %lu:%llu but got %ld:%llu", sortSet.begin()->trackID, sortSet.begin()->time, currentPacket.getTrackId(), currentPacket.getTime());
DEBUG_MSG(DLVL_WARN, "Warning: input is inconsistent. Expected %lu:%llu but got %ld:%llu - cancelling playback", sortSet.begin()->trackID, sortSet.begin()->time, currentPacket.getTrackId(), currentPacket.getTime());
perfect = false;
myConn.close();
}
}else{
DEBUG_MSG(DLVL_HIGH, "Did not receive expected %lu:%llu but got %ld:%llu - throwing it away", sortSet.begin()->trackID, sortSet.begin()->time, currentPacket.getTrackId(), currentPacket.getTime());
}
return;
}
//keep track of where we are
if (!sortSet.empty()){