Attempted RTMP fix 2

This commit is contained in:
Thulinma 2011-06-22 02:18:58 +02:00
parent a0763febf1
commit 0cb87218d9

View file

@ -42,7 +42,7 @@ std::string RTMPStream::Chunk::Pack(){
unsigned int tmpi; unsigned int tmpi;
unsigned char chtype = 0x00; unsigned char chtype = 0x00;
timestamp -= firsttime; timestamp -= firsttime;
if (prev.cs_id == cs_id){ if ((prev.msg_type_id > 0) && (prev.cs_id == cs_id)){
if (msg_stream_id == prev.msg_stream_id){ if (msg_stream_id == prev.msg_stream_id){
chtype = 0x40;//do not send msg_stream_id chtype = 0x40;//do not send msg_stream_id
if (len == prev.len){ if (len == prev.len){
@ -292,6 +292,7 @@ bool RTMPStream::Chunk::Parse(std::string & indata){
break; break;
case 0x40: case 0x40:
if (indata.size() < i+7) return false; //can't read whole header if (indata.size() < i+7) return false; //can't read whole header
if (prev.msg_type_id == 0){fprintf(stderr, "Warning: Header type 0x40 with no valid previous chunk!\n");}
timestamp = indata[i++]*256*256; timestamp = indata[i++]*256*256;
timestamp += indata[i++]*256; timestamp += indata[i++]*256;
timestamp += indata[i++]; timestamp += indata[i++];
@ -305,6 +306,7 @@ bool RTMPStream::Chunk::Parse(std::string & indata){
break; break;
case 0x80: case 0x80:
if (indata.size() < i+3) return false; //can't read whole header if (indata.size() < i+3) return false; //can't read whole header
if (prev.msg_type_id == 0){fprintf(stderr, "Warning: Header type 0x80 with no valid previous chunk!\n");}
timestamp = indata[i++]*256*256; timestamp = indata[i++]*256*256;
timestamp += indata[i++]*256; timestamp += indata[i++]*256;
timestamp += indata[i++]; timestamp += indata[i++];
@ -315,6 +317,7 @@ bool RTMPStream::Chunk::Parse(std::string & indata){
msg_stream_id = prev.msg_stream_id; msg_stream_id = prev.msg_stream_id;
break; break;
case 0xC0: case 0xC0:
if (prev.msg_type_id == 0){fprintf(stderr, "Warning: Header type 0xC0 with no valid previous chunk!\n");}
timestamp = prev.timestamp; timestamp = prev.timestamp;
len = prev.len; len = prev.len;
len_left = prev.len_left; len_left = prev.len_left;