Minder debugging

This commit is contained in:
Thulinma 2010-11-08 20:15:47 +01:00
parent 6f11ca6713
commit 540e729dc6
2 changed files with 6 additions and 9 deletions

View file

@ -126,6 +126,7 @@ int main(int argc, char ** argv){
}
//only send data if previous data has been ACK'ed...
//if (snd_cnt - snd_window_at < snd_window_size){
if (DDV_ready(ss)){
if (FLV_GetPacket(tag, ss)){//able to read a full packet?
ts = tag->data[7] * 256*256*256;
ts += tag->data[4] * 256*256;
@ -151,6 +152,7 @@ int main(int argc, char ** argv){
fprintf(stderr, "Sent a tag to %i\n", CONN_fd);
#endif
}
}
//}
}
//send ACK if we received a whole window

View file

@ -52,9 +52,6 @@ bool ReadUntil(char * buffer, unsigned int count, unsigned int & sofar, int sock
//resizes FLV_Pack data field bigger if data doesn't fit
// (does not auto-shrink for speed!)
bool FLV_GetPacket(FLV_Pack *& p, int sock){
int preflags = fcntl(sock, F_GETFL, 0);
int postflags = preflags | O_NONBLOCK;
fcntl(sock, F_SETFL, postflags);
static bool done = true;
static unsigned int sofar = 0;
if (!p){p = (FLV_Pack*)calloc(1, sizeof(FLV_Pack));}
@ -79,7 +76,7 @@ bool FLV_GetPacket(FLV_Pack *& p, int sock){
p->len = p->data[3] + 15;
p->len += (p->data[2] << 8);
p->len += (p->data[1] << 16);
fprintf(stderr, "Tag of len %i\n", p->len);
//fprintf(stderr, "Tag of len %i\n", p->len);
if (p->buf < p->len){p->data = (char*)realloc(p->data, p->len);p->buf = p->len;}
done = false;
}
@ -92,11 +89,9 @@ bool FLV_GetPacket(FLV_Pack *& p, int sock){
if ((p->data[0] == 0x09) && (((p->data[11] & 0xf0) >> 4) == 1)){p->isKeyframe = true;}
done = true;
sofar = 0;
fcntl(sock, F_SETFL, preflags);
return true;
}
}
fcntl(sock, F_SETFL, preflags);
return false;
}//FLV_GetPacket