Various optimizations to outputs and RTMP in particular.

This commit is contained in:
Thulinma 2014-05-12 13:55:40 +02:00
parent c82aa656cd
commit 68baed4af8
2 changed files with 7 additions and 8 deletions

View file

@ -215,16 +215,13 @@ namespace Mist {
}
unsigned int Output::getKeyForTime(long unsigned int trackId, long long timeStamp){
if (!myMeta.tracks[trackId].keys.size()){
DTSC::Track & trk = myMeta.tracks[trackId];
if (!trk.keys.size()){
return 0;
}
unsigned int keyNo = myMeta.tracks[trackId].keys.begin()->getNumber();
for (std::deque<DTSC::Key>::iterator it = myMeta.tracks[trackId].keys.begin(); it != myMeta.tracks[trackId].keys.end(); it++){
if (it->getTime() <= timeStamp){
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++){
keyNo = it->getNumber();
}else{
break;
}
}
return keyNo;
}

View file

@ -194,6 +194,7 @@ namespace Mist {
}
//send the header
myConn.setBlocking(true);
myConn.SendNow(rtmpheader, header_len);
//set the header's first byte to the "continue" type chunk, for later use
rtmpheader[0] = 0xC4;
@ -216,6 +217,7 @@ namespace Mist {
++steps;
}
}
myConn.setBlocking(false);
//update the sent data counter
RTMPStream::snd_cnt += header_len + data_len + steps;
}