Fixed various live issues.

This commit is contained in:
Thulinma 2014-12-30 02:08:14 +01:00
parent a3ae7c365f
commit a001feafca
2 changed files with 11 additions and 4 deletions

View file

@ -421,8 +421,9 @@ void Controller::parseStatistics(char * data, size_t len, unsigned int id){
/// Returns true if this stream has at least one connected client.
bool Controller::hasViewers(std::string streamName){
if (sessions.size()){
long long currTime = Util::epoch();
for (std::map<sessIndex, statSession>::iterator it = sessions.begin(); it != sessions.end(); it++){
if (it->first.streamName == streamName){
if (it->first.streamName == streamName && it->second.hasDataFor(currTime)){
return true;
}
}

View file

@ -390,7 +390,7 @@ namespace Mist {
long amountKey = ntohl((((long long int*)indexPages[trackId].mapped)[i]) & 0xFFFFFFFF);
if (amountKey == 0){continue;}
long tmpKey = ntohl(((((long long int*)indexPages[trackId].mapped)[i]) >> 32) & 0xFFFFFFFF);
if (tmpKey <= keyNum && (tmpKey + amountKey) > keyNum){
if (tmpKey <= keyNum && ((tmpKey?tmpKey:1) + amountKey) > keyNum){
return tmpKey;
}
}
@ -629,7 +629,7 @@ namespace Mist {
buffer.insert(nxt);
}else{
//after ~10 seconds, give up and drop the track.
DEBUG_MSG(DLVL_DEVEL, "Empty packet on track %u - could not reload, dropping track.", nxt.tid);
DEBUG_MSG(DLVL_DEVEL, "Empty packet on track %u @ key %lu (next=%d) - could not reload, dropping track.", nxt.tid, nxtKeyNum[nxt.tid]+1, nextPage);
}
//keep updating the metadata at 250ms intervals while waiting for more data
Util::sleep(250);
@ -661,7 +661,13 @@ namespace Mist {
if (currentPacket.getTime() != nxt.time && nxt.time){
DEBUG_MSG(DLVL_MEDIUM, "ACTUALLY Loaded track %ld (next=%lu), %llu ms", currentPacket.getTrackId(), nxtKeyNum[nxt.tid], currentPacket.getTime());
}
if (currentPacket.getFlag("keyframe")){
if (myMeta.live){
updateMeta();
}
nxtKeyNum[nxt.tid] = getKeyForTime(nxt.tid, currentPacket.getTime());
DEBUG_MSG(DLVL_VERYHIGH, "Track %u @ %llums = key %lu", nxt.tid, currentPacket.getTime(), nxtKeyNum[nxt.tid]);
}
emptyCount = 0;
}
nxt.offset += currentPacket.getDataLen();