Added byte position counter for invalid RTMP data printout in the analyser.

This commit is contained in:
Thulinma 2014-04-29 15:32:45 +02:00
parent 52e8e2a2ae
commit ee93e80b8d

View file

@ -52,6 +52,7 @@ namespace Analysers {
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);
AMF::Object3 amf3data("empty", AMF::AMF3_DDV_CONTAINER); AMF::Object3 amf3data("empty", AMF::AMF3_DDV_CONTAINER);
unsigned int read_in = 0;
while (std::cin.good() || inbuffer.size()){ while (std::cin.good() || inbuffer.size()){
if (next.Parse(inbuffer)){ if (next.Parse(inbuffer)){
@ -61,8 +62,8 @@ namespace Analysers {
} }
switch (next.msg_type_id){ switch (next.msg_type_id){
case 0: //does not exist case 0: //does not exist
fprintf(stderr, "Error chunk - %i, %i, %i, %i, %i\n", next.cs_id, next.timestamp, next.real_len, next.len_left, next.msg_stream_id); fprintf(stderr, "Error chunk @ %lu - CS%i, T%i, L%i, LL%i, MID%i\n", read_in-inbuffer.size(), next.cs_id, next.timestamp, next.real_len, next.len_left, next.msg_stream_id);
//return 0; return 0;
break; //happens when connection breaks unexpectedly break; //happens when connection breaks unexpectedly
case 1: //set chunk size case 1: //set chunk size
RTMPStream::chunk_rec_max = ntohl(*(int*)next.data.c_str()); RTMPStream::chunk_rec_max = ntohl(*(int*)next.data.c_str());
@ -177,6 +178,7 @@ namespace Analysers {
}else{ //if chunk parsed }else{ //if chunk parsed
if (std::cin.good()){ if (std::cin.good()){
inbuffer += std::cin.get(); inbuffer += std::cin.get();
++read_in;
}else{ }else{
inbuffer.clear(); inbuffer.clear();
} }