RTMP bugfixorringz

This commit is contained in:
Thulinma 2011-04-16 23:39:22 +02:00
commit 7d35eb5852

View file

@ -249,15 +249,17 @@ std::string RTMPStream::SendUSR(unsigned char type, unsigned int data, unsigned
bool RTMPStream::Chunk::Parse(std::string & indata){
gettimeofday(&RTMPStream::lastrec, 0);
unsigned int i = 0;
if (indata.size() < 3) return false;//need at least 3 bytes to continue
if (indata.size() < 1) return false;//need at least a byte
unsigned char chunktype = indata[i++];
//read the chunkstream ID properly
switch (chunktype & 0x3F){
case 0:
if (indata.size() < 2) return false;//need at least 2 bytes to continue
cs_id = indata[i++] + 64;
break;
case 1:
if (indata.size() < 3) return false;//need at least 3 bytes to continue
cs_id = indata[i++] + 64;
cs_id += indata[i++] * 256;
break;
@ -352,7 +354,7 @@ bool RTMPStream::Chunk::Parse(std::string & indata){
if (len_left == 0){
return true;
}else{
return false;
return Parse(indata);
}
}else{
data = "";