Improved RTMP analyzer speed and precision.

This commit is contained in:
Thulinma 2014-09-22 13:37:15 +02:00
parent 988a12d86f
commit 549cf525f0

View file

@ -48,6 +48,7 @@ namespace Analysers {
inbuffer += std::cin.get(); inbuffer += std::cin.get();
} //read all of std::cin to temp } //read all of std::cin to temp
inbuffer.erase(0, 3073); //strip the handshake part inbuffer.erase(0, 3073); //strip the handshake part
RTMPStream::rec_cnt += 3073;
RTMPStream::Chunk next; RTMPStream::Chunk next;
FLV::Tag F; //FLV holder FLV::Tag F; //FLV holder
AMF::Object amfdata("empty", AMF::AMF0_DDV_CONTAINER); AMF::Object amfdata("empty", AMF::AMF0_DDV_CONTAINER);
@ -183,10 +184,15 @@ namespace Analysers {
} //switch for type of chunk } //switch for type of chunk
}else{ //if chunk parsed }else{ //if chunk parsed
if (std::cin.good()){ if (std::cin.good()){
char newchar = std::cin.get(); unsigned int charCount = 0;
if (std::cin.good()){ inbuffer.reserve(4096);
inbuffer += newchar; while (std::cin.good() && charCount < 4096){
++read_in; char newchar = std::cin.get();
if (std::cin.good()){
inbuffer += newchar;
++read_in;
++charCount;
}
} }
}else{ }else{
inbuffer.clear(); inbuffer.clear();