From 71efc656840ffdaf918e02d4305f54143ec71bf1 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Mon, 17 Jan 2011 14:30:11 +0100 Subject: [PATCH] Testing oplossing --- Buffer/main.cpp | 3 +++ Connector_RTMP/main.cpp | 14 ++++++++------ Connector_RTMP/parsechunks.cpp | 3 ++- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Buffer/main.cpp b/Buffer/main.cpp index 243205e2..344ddb9d 100644 --- a/Buffer/main.cpp +++ b/Buffer/main.cpp @@ -38,12 +38,14 @@ class user{ int MyBuffer_len; int MyNum; int currsend; + bool gotproperaudio; void * lastpointer; static int UserCount; int s; user(int fd){ s = fd; MyNum = UserCount++; + gotproperaudio = false; std::cout << "User " << MyNum << " connected" << std::endl; }//constructor void Disconnect(std::string reason) { @@ -64,6 +66,7 @@ class user{ return (currsend == todo); } void Send(buffer ** ringbuf, int buffers){ + //TODO: Bij MP3: gotproperaudio - if false, stuur alleen als eerste byte is 0xFF en set op true //not connected? cancel if (s < 0){return;} //still waiting for next buffer? check it diff --git a/Connector_RTMP/main.cpp b/Connector_RTMP/main.cpp index 24a7d12f..c8f3dd10 100644 --- a/Connector_RTMP/main.cpp +++ b/Connector_RTMP/main.cpp @@ -3,6 +3,7 @@ //debugging level 2 = errors //debugging level 3 = status information //debugging level 4 = extremely verbose status information +//debugging level 5 = save all streams to FLV files #define DEBUG 3 #include @@ -60,11 +61,12 @@ int mainHandler(int connection){ ev.data.fd = CONN_fd; epoll_ctl(poller, EPOLL_CTL_ADD, CONN_fd, &ev); struct epoll_event events[1]; - - + #if DEBUG >= 5 + //for writing whole stream to a file FILE * tmpfile = 0; char tmpstr[200]; - + #endif + while (!socketError && !All_Hell_Broke_Loose){ //only parse input if available or not yet init'ed //rightnow = getNowMS(); @@ -135,15 +137,15 @@ int mainHandler(int connection){ tag->data[6] = ftst % 256; } SendMedia((unsigned char)tag->data[0], (unsigned char *)tag->data+11, tag->len-15, ts); - + #if DEBUG >= 5 + //write whole stream to a file if (tmpfile == 0){ sprintf(tmpstr, "./tmpfile_socket_%i.flv", CONN_fd); tmpfile = fopen(tmpstr, "w"); fwrite(FLVHeader, 13, 1, tmpfile); } fwrite(tag->data, tag->len, 1, tmpfile); - - + #endif lastcheck = getNowMS(); #if DEBUG >= 4 fprintf(stderr, "Sent a tag to %i\n", CONN_fd); diff --git a/Connector_RTMP/parsechunks.cpp b/Connector_RTMP/parsechunks.cpp index d509173b..cf11a562 100644 --- a/Connector_RTMP/parsechunks.cpp +++ b/Connector_RTMP/parsechunks.cpp @@ -45,7 +45,8 @@ void parseChunk(){ //6 = pingrequest, 4 bytes data //7 = pingresponse, 4 bytes data //we don't need to process this - } break; + SendCTL(3, rec_cnt);//send ack (msg 3) + } break; case 5://window size of other end #if DEBUG >= 4 fprintf(stderr, "CTRL: Window size\n");