Buffer conn timeout fix

This commit is contained in:
Thulinma 2010-11-06 16:38:19 +01:00
parent 82c116716a
commit de701fc58e
4 changed files with 21 additions and 12 deletions

View file

@ -55,7 +55,9 @@ int main( int argc, char * argv[] ) {
//new FLV file, read the file header again. //new FLV file, read the file header again.
FLV_Readheader(); FLV_Readheader();
} else { } else {
FLV_GetPacket(ringbuf[current_buffer]->FLV); if (!FLV_GetPacket(ringbuf[current_buffer]->FLV)){
break;//wrong packet? something bust be broken. End program!
}
packtype = ringbuf[current_buffer]->FLV->data[0]; packtype = ringbuf[current_buffer]->FLV->data[0];
//store metadata, if available //store metadata, if available
if (packtype == 0x12){ if (packtype == 0x12){

View file

@ -13,7 +13,7 @@ client-clean:
#cd Connector_RTSP; $(MAKE) clean #cd Connector_RTSP; $(MAKE) clean
cd Buffer; $(MAKE) clean cd Buffer; $(MAKE) clean
clean: client-clean clean: client-clean
client-install: client client-install: client-clean client
cp -f ./Connector_HTTP/Connector_HTTP /usr/bin/ cp -f ./Connector_HTTP/Connector_HTTP /usr/bin/
cp -f ./Connector_RTMP/Connector_RTMP /usr/bin/ cp -f ./Connector_RTMP/Connector_RTMP /usr/bin/
cp -f ./Connector_RAW/Connector_RAW /usr/bin/ cp -f ./Connector_RAW/Connector_RAW /usr/bin/

20
PLS
View file

@ -8,6 +8,8 @@ service ddvtechhttp
server = /usr/bin/Connector_HTTP server = /usr/bin/Connector_HTTP
port = 7337 port = 7337
wait = no wait = no
per_source = 10
cps = 100 5
} }
service ddvtechrtmp service ddvtechrtmp
@ -20,17 +22,21 @@ service ddvtechrtmp
server = /usr/bin/Connector_RTMP server = /usr/bin/Connector_RTMP
port = 1935 port = 1935
wait = no wait = no
per_source = 10
cps = 100 5
} }
service ddvtechraw service ddvtechraw
{ {
disable = no disable = no
type = UNLISTED type = UNLISTED
protocol = tcp protocol = tcp
socket_type = stream socket_type = stream
user = root user = root
server = /usr/bin/Connector_RAW server = /usr/bin/Connector_RAW
port = 3773 port = 3773
wait = no wait = no
per_source = 10
cps = 100 5
} }

View file

@ -35,15 +35,16 @@ bool FLV_Readheader(){
//will assign pointer if null //will assign pointer if null
//resizes FLV_Pack data field bigger if data doesn't fit //resizes FLV_Pack data field bigger if data doesn't fit
// (does not auto-shrink for speed!) // (does not auto-shrink for speed!)
void FLV_GetPacket(FLV_Pack *& p){ bool FLV_GetPacket(FLV_Pack *& p){
if (!p){p = (FLV_Pack*)calloc(1, sizeof(FLV_Pack));} if (!p){p = (FLV_Pack*)calloc(1, sizeof(FLV_Pack));}
if (p->buf < 15){p->data = (char*)realloc(p->data, 15); p->buf = 15;} if (p->buf < 15){p->data = (char*)realloc(p->data, 15); p->buf = 15;}
fread(p->data,1,11,stdin); if (fread(p->data,1,11,stdin) != 11){return false;}
p->len = p->data[3] + 15; p->len = p->data[3] + 15;
p->len += (p->data[2] << 8); p->len += (p->data[2] << 8);
p->len += (p->data[1] << 16); p->len += (p->data[1] << 16);
if (p->buf < p->len){p->data = (char*)realloc(p->data, p->len);p->buf = p->len;} if (p->buf < p->len){p->data = (char*)realloc(p->data, p->len);p->buf = p->len;}
fread(p->data+11,1,p->len-11,stdin); if (fread(p->data+11,1,p->len-11,stdin) != (unsigned int)(p->len-11)){return false;}
p->isKeyframe = false; p->isKeyframe = false;
if ((p->data[0] == 0x09) && (((p->data[11] & 0xf0) >> 4) == 1)){p->isKeyframe = true;} if ((p->data[0] == 0x09) && (((p->data[11] & 0xf0) >> 4) == 1)){p->isKeyframe = true;}
return true;
}//FLV_GetPacket }//FLV_GetPacket