diff --git a/Connector_RTMP/main.cpp b/Connector_RTMP/main.cpp index 5eff723d..48ed22f5 100644 --- a/Connector_RTMP/main.cpp +++ b/Connector_RTMP/main.cpp @@ -97,9 +97,9 @@ int main(int argc, char ** argv){ epoll_ctl(poller, EPOLL_CTL_ADD, CONN_fd, &ev); struct epoll_event events[1]; - - - + + + while (!socketError && !All_Hell_Broke_Loose){ //only parse input if available or not yet init'ed //rightnow = getNowMS(); @@ -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 diff --git a/util/flv_sock.cpp b/util/flv_sock.cpp index 58f3a14d..8de52131 100644 --- a/util/flv_sock.cpp +++ b/util/flv_sock.cpp @@ -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