RTMP bugfixorringz
This commit is contained in:
commit
7d35eb5852
1 changed files with 6 additions and 4 deletions
|
@ -249,15 +249,17 @@ std::string RTMPStream::SendUSR(unsigned char type, unsigned int data, unsigned
|
||||||
bool RTMPStream::Chunk::Parse(std::string & indata){
|
bool RTMPStream::Chunk::Parse(std::string & indata){
|
||||||
gettimeofday(&RTMPStream::lastrec, 0);
|
gettimeofday(&RTMPStream::lastrec, 0);
|
||||||
unsigned int i = 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++];
|
unsigned char chunktype = indata[i++];
|
||||||
//read the chunkstream ID properly
|
//read the chunkstream ID properly
|
||||||
switch (chunktype & 0x3F){
|
switch (chunktype & 0x3F){
|
||||||
case 0:
|
case 0:
|
||||||
|
if (indata.size() < 2) return false;//need at least 2 bytes to continue
|
||||||
cs_id = indata[i++] + 64;
|
cs_id = indata[i++] + 64;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
if (indata.size() < 3) return false;//need at least 3 bytes to continue
|
||||||
cs_id = indata[i++] + 64;
|
cs_id = indata[i++] + 64;
|
||||||
cs_id += indata[i++] * 256;
|
cs_id += indata[i++] * 256;
|
||||||
break;
|
break;
|
||||||
|
@ -352,7 +354,7 @@ bool RTMPStream::Chunk::Parse(std::string & indata){
|
||||||
if (len_left == 0){
|
if (len_left == 0){
|
||||||
return true;
|
return true;
|
||||||
}else{
|
}else{
|
||||||
return false;
|
return Parse(indata);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
data = "";
|
data = "";
|
||||||
|
|
Loading…
Add table
Reference in a new issue