RTMP Analyser performance improvements.
This commit is contained in:
parent
2e0201e1e8
commit
e16723c466
1 changed files with 133 additions and 124 deletions
|
@ -43,7 +43,8 @@ namespace Analysers {
|
|||
}
|
||||
|
||||
std::string inbuffer;
|
||||
while (std::cin.good()){
|
||||
inbuffer.reserve(3073);
|
||||
while (std::cin.good() && inbuffer.size() < 3073){
|
||||
inbuffer += std::cin.get();
|
||||
} //read all of std::cin to temp
|
||||
inbuffer.erase(0, 3073); //strip the handshake part
|
||||
|
@ -52,7 +53,8 @@ namespace Analysers {
|
|||
AMF::Object amfdata("empty", AMF::AMF0_DDV_CONTAINER);
|
||||
AMF::Object3 amf3data("empty", AMF::AMF3_DDV_CONTAINER);
|
||||
|
||||
while (next.Parse(inbuffer)){
|
||||
while (std::cin.good() || inbuffer.size()){
|
||||
if (next.Parse(inbuffer)){
|
||||
if (Detail & DETAIL_VERBOSE){
|
||||
fprintf(stderr, "Chunk info: [%#2X] CS ID %u, timestamp %u, len %u, type ID %u, Stream ID %u\n", next.headertype, next.cs_id, next.timestamp,
|
||||
next.len, next.msg_type_id, next.msg_stream_id);
|
||||
|
@ -184,7 +186,14 @@ namespace Analysers {
|
|||
return 1;
|
||||
break;
|
||||
} //switch for type of chunk
|
||||
} //while chunk parsed
|
||||
}else{ //if chunk parsed
|
||||
if (std::cin.good()){
|
||||
inbuffer += std::cin.get();
|
||||
}else{
|
||||
inbuffer.clear();
|
||||
}
|
||||
}
|
||||
}//while std::cin.good()
|
||||
fprintf(stderr, "No more readable data\n");
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue