diff --git a/src/buffer.cpp b/src/buffer.cpp
index 13b3fc40..704f4833 100644
--- a/src/buffer.cpp
+++ b/src/buffer.cpp
@@ -53,7 +53,7 @@ namespace Buffer {
void handleUser(void * v_usr){
user * usr = (user*)v_usr;
-#if DEBUG >= 4
+#if DEBUG >= 5
std::cerr << "Thread launched for user " << usr->MyStr << ", socket number " << usr->S.getSocket() << std::endl;
#endif
diff --git a/src/conn_http.cpp b/src/conn_http.cpp
index c7d6b4f3..fe039867 100644
--- a/src/conn_http.cpp
+++ b/src/conn_http.cpp
@@ -90,24 +90,28 @@ namespace Connector_HTTP {
}
/// Handles requests without associated handler, displaying a nice friendly error message.
- void Handle_None(HTTP::Parser & H, Socket::Connection * conn){
+ long long int Handle_None(HTTP::Parser & H, Socket::Connection * conn){
H.Clean();
H.SetHeader("Server", "mistserver/" PACKAGE_VERSION "/" + Util::Config::libver);
H.SetBody(
"
Unsupported Media TypeUnsupported Media Type
The server isn't quite sure what you wanted to receive from it.");
+ long long int ret = Util::getMS();
conn->SendNow(H.BuildResponse("415", "Unsupported Media Type"));
+ return ret;
}
- void Handle_Timeout(HTTP::Parser & H, Socket::Connection * conn){
+ long long int Handle_Timeout(HTTP::Parser & H, Socket::Connection * conn){
H.Clean();
H.SetHeader("Server", "mistserver/" PACKAGE_VERSION "/" + Util::Config::libver);
H.SetBody(
"Gateway timeoutGateway timeout
Though the server understood your request and attempted to handle it, somehow handling it took longer than it should. Your request has been cancelled - please try again later.");
+ long long int ret = Util::getMS();
conn->SendNow(H.BuildResponse("504", "Gateway Timeout"));
+ return ret;
}
/// Handles internal requests.
- void Handle_Internal(HTTP::Parser & H, Socket::Connection * conn){
+ long long int Handle_Internal(HTTP::Parser & H, Socket::Connection * conn){
std::string url = H.getUrl();
@@ -117,8 +121,9 @@ namespace Connector_HTTP {
H.SetHeader("Server", "mistserver/" PACKAGE_VERSION "/" + Util::Config::libver);
H.SetBody(
"");
+ long long int ret = Util::getMS();
conn->SendNow(H.BuildResponse("200", "OK"));
- return;
+ return ret;
} //crossdomain.xml
if (url == "/clientaccesspolicy.xml"){
@@ -127,8 +132,9 @@ namespace Connector_HTTP {
H.SetHeader("Server", "mistserver/" PACKAGE_VERSION "/" + Util::Config::libver);
H.SetBody(
"");
+ long long int ret = Util::getMS();
conn->SendNow(H.BuildResponse("200", "OK"));
- return;
+ return ret;
} //clientaccesspolicy.xml
if ((url.length() > 9 && url.substr(0, 6) == "/info_" && url.substr(url.length() - 3, 3) == ".js")
@@ -192,15 +198,16 @@ namespace Connector_HTTP {
response.append("(\"" + streamname + "\"));\n");
}
H.SetBody(response);
+ long long int ret = Util::getMS();
conn->SendNow(H.BuildResponse("200", "OK"));
- return;
+ return ret;
} //embed code generator
- Handle_None(H, conn); //anything else doesn't get handled
+ return Handle_None(H, conn); //anything else doesn't get handled
}
/// Handles requests without associated handler, displaying a nice friendly error message.
- void Handle_Through_Connector(HTTP::Parser & H, Socket::Connection * conn, std::string & connector){
+ long long int Handle_Through_Connector(HTTP::Parser & H, Socket::Connection * conn, std::string & connector){
//create a unique ID based on a hash of the user agent and host, followed by the stream name and connector
std::string uid = Secure::md5(H.GetHeader("User-Agent") + conn->getHost()) + "_" + H.GetVar("stream") + "_" + connector;
H.SetHeader("X-Stream", H.GetVar("stream"));
@@ -222,7 +229,7 @@ namespace Connector_HTTP {
std::cout << "Created new connection " << uid << std::endl;
#endif
}else{
-#if DEBUG >= 4
+#if DEBUG >= 5
std::cout << "Re-using connection " << uid << std::endl;
#endif
}
@@ -241,8 +248,7 @@ namespace Connector_HTTP {
tthread::lock_guard guard(connconn[uid]->in_use);
//if the server connection is dead, handle as timeout.
if ( !connconn.count(uid) || !connconn[uid]->conn->connected()){
- Handle_Timeout(H, conn);
- return;
+ return Handle_Timeout(H, conn);
}
//forward the original request
connconn[uid]->conn->SendNow(request);
@@ -270,8 +276,7 @@ namespace Connector_HTTP {
//keep trying unless the timeout triggers
if (timeout++ > 4000){
std::cout << "[20s timeout triggered]" << std::endl;
- Handle_Timeout(H, conn);
- return;
+ return Handle_Timeout(H, conn);
}else{
Util::sleep(5);
}
@@ -279,9 +284,9 @@ namespace Connector_HTTP {
}
if ( !connconn.count(uid) || !connconn[uid]->conn->connected() || !conn->connected()){
//failure, disconnect and sent error to user
- Handle_Timeout(H, conn);
- return;
+ return Handle_Timeout(H, conn);
}else{
+ long long int ret = Util::getMS();
//success, check type of response
if (H.GetHeader("Content-Length") != ""){
//known length - simply re-send the request with added headers and continue
@@ -311,6 +316,7 @@ namespace Connector_HTTP {
delete myConn;
conn->close();
}
+ return ret;
}
}
@@ -383,11 +389,12 @@ namespace Connector_HTTP {
}
if (Client.Read(conn->Received().get())){
std::string handler = getHTTPType(Client);
- long long int startms = Util::getMS();
#if DEBUG >= 4
std::cout << "Received request: " << Client.getUrl() << " (" << conn->getSocket() << ") => " << handler << " (" << Client.GetVar("stream")
<< ")" << std::endl;
+ long long int startms = Util::getMS();
#endif
+ long long int midms = 0;
bool closeConnection = false;
if (Client.GetHeader("Connection") == "close"){
closeConnection = true;
@@ -395,15 +402,16 @@ namespace Connector_HTTP {
if (handler == "none" || handler == "internal"){
if (handler == "internal"){
- Handle_Internal(Client, conn);
+ midms = Handle_Internal(Client, conn);
}else{
- Handle_None(Client, conn);
+ midms = Handle_None(Client, conn);
}
}else{
- Handle_Through_Connector(Client, conn, handler);
+ midms = Handle_Through_Connector(Client, conn, handler);
}
#if DEBUG >= 4
- std::cout << "Completed request (" << conn->getSocket() << ") " << handler << " in " << (Util::getMS() - startms) << " ms" << std::endl;
+ long long int nowms = Util::getMS();
+ std::cout << "Completed request " << conn->getSocket() << " " << handler << " in " << (midms - startms) << " ms (processing) / " << (nowms - midms) << " ms (transfer)" << std::endl;
#endif
if (closeConnection){
break;
diff --git a/src/conn_http_live.cpp b/src/conn_http_live.cpp
index 831bd4d6..6410d909 100644
--- a/src/conn_http_live.cpp
+++ b/src/conn_http_live.cpp
@@ -137,7 +137,7 @@ namespace Connector_HTTP {
}
}
if (HTTP_R.Read(conn.Received().get())){
-#if DEBUG >= 4
+#if DEBUG >= 5
std::cout << "Received request: " << HTTP_R.getUrl() << std::endl;
#endif
conn.setHost(HTTP_R.GetHeader("X-Origin"));
@@ -192,9 +192,6 @@ namespace Connector_HTTP {
std::string manifest = BuildIndex(streamname, Strm.metadata);
HTTP_S.SetBody(manifest);
conn.SendNow(HTTP_S.BuildResponse("200", "OK"));
-#if DEBUG >= 3
- printf("Sent index\n");
-#endif
pending_manifest = false;
}else{
pending_manifest = true;
@@ -226,7 +223,7 @@ namespace Connector_HTTP {
continue;
}
ss.setBlocking(false);
-#if DEBUG >= 3
+#if DEBUG >= 5
fprintf(stderr, "Everything connected, starting to send video data...\n");
#endif
inited = true;
@@ -250,9 +247,6 @@ namespace Connector_HTTP {
HTTP_S.SetHeader("Connection", "keep-alive");
HTTP_S.SetBody(manifest);
conn.SendNow(HTTP_S.BuildResponse("200", "OK"));
-#if DEBUG >= 3
- printf("Sent manifest\n");
-#endif
pending_manifest = false;
}
if ( !receive_marks && Strm.metadata.isMember("length")){
@@ -260,13 +254,7 @@ namespace Connector_HTTP {
}
if ((Strm.getPacket(0).isMember("keyframe") && !receive_marks) || Strm.lastType() == DTSC::PAUSEMARK){
TSBuf.flush();
-#if DEBUG >= 4
- fprintf(stderr, "Received a %s fragment of %i bytes.\n", Strm.getPacket(0)["datatype"].asString().c_str(), TSBuf.str().size());
-#endif
if (Flash_RequestPending > 0 && TSBuf.str().size()){
-#if DEBUG >= 3
- fprintf(stderr, "Sending a fragment...");
-#endif
HTTP_S.Clean();
HTTP_S.protocol = "HTTP/1.1";
HTTP_S.SetHeader("Content-Type", "video/mp2t");
@@ -278,9 +266,6 @@ namespace Connector_HTTP {
TSBuf.str("");
Flash_RequestPending--;
PacketNumber = 0;
-#if DEBUG >= 3
- fprintf(stderr, "Done\n");
-#endif
}
TSBuf.str("");
}
@@ -367,9 +352,6 @@ namespace Connector_HTTP {
std::string manifest = BuildIndex(streamname, Strm.metadata);
HTTP_S.SetBody(manifest);
conn.SendNow(HTTP_S.BuildResponse("200", "OK"));
-#if DEBUG >= 3
- printf("Sent index\n");
-#endif
pending_manifest = false;
}
}
@@ -381,17 +363,8 @@ namespace Connector_HTTP {
conn.close();
ss.SendNow(conn.getStats("HTTP_Live").c_str());
ss.close();
-#if DEBUG >= 1
- fprintf(stderr, "User %i disconnected.\n", conn.getSocket());
- if (inited){
- fprintf(stderr, "Status was: inited\n");
- }else{
- if (ready4data){
- fprintf(stderr, "Status was: ready4data\n");
- }else{
- fprintf(stderr, "Status was: connected\n");
- }
- }
+#if DEBUG >= 5
+ fprintf(stderr, "HLS: User %i disconnected.\n", conn.getSocket());
#endif
return 0;
} //Connector_HTTP_Dynamic main function
@@ -415,7 +388,7 @@ int main(int argc, char ** argv){
if (myid == 0){ //if new child, start MAINHANDLER
return Connector_HTTP::Connector_HTTP_Live(S);
}else{ //otherwise, do nothing or output debugging text
-#if DEBUG >= 3
+#if DEBUG >= 5
fprintf(stderr, "Spawned new process %i for socket %i\n", (int)myid, S.getSocket());
#endif
}
diff --git a/src/conn_http_progressive.cpp b/src/conn_http_progressive.cpp
index b625573e..5c5284ee 100644
--- a/src/conn_http_progressive.cpp
+++ b/src/conn_http_progressive.cpp
@@ -55,7 +55,7 @@ namespace Connector_HTTP {
}
}
if (HTTP_R.Read(conn.Received().get())){
-#if DEBUG >= 4
+#if DEBUG >= 5
std::cout << "Received request: " << HTTP_R.getUrl() << std::endl;
#endif
conn.setHost(HTTP_R.GetHeader("X-Origin"));
@@ -133,9 +133,6 @@ namespace Connector_HTTP {
cmd << "s " << seek_sec << "\n";
ss.SendNow(cmd.str().c_str());
}
-#if DEBUG >= 3
- fprintf(stderr, "Everything connected, starting to send video data...\n");
-#endif
ss.SendNow("p\n");
inited = true;
}
@@ -173,9 +170,6 @@ namespace Connector_HTTP {
}
}
progressive_has_sent_header = true;
-#if DEBUG >= 1
- fprintf(stderr, "Sent progressive FLV header\n");
-#endif
}
if ( !isMP3){
tag.DTSCLoader(Strm);
@@ -219,7 +213,7 @@ int main(int argc, char ** argv){
if (myid == 0){ //if new child, start MAINHANDLER
return Connector_HTTP::Connector_HTTP_Progressive(S);
}else{ //otherwise, do nothing or output debugging text
-#if DEBUG >= 3
+#if DEBUG >= 5
fprintf(stderr, "Spawned new process %i for socket %i\n", (int)myid, S.getSocket());
#endif
}
diff --git a/src/conn_http_smooth.cpp b/src/conn_http_smooth.cpp
index 055190c0..1d2ea0a4 100644
--- a/src/conn_http_smooth.cpp
+++ b/src/conn_http_smooth.cpp
@@ -132,7 +132,7 @@ namespace Connector_HTTP {
}
}
if (HTTP_R.Read(conn.Received().get())){
-#if DEBUG >= 4
+#if DEBUG >= 5
std::cout << "Received request: " << HTTP_R.getUrl() << std::endl;
#endif
conn.setHost(HTTP_R.GetHeader("X-Origin"));
@@ -167,9 +167,6 @@ namespace Connector_HTTP {
}
tempStr = tempStr.substr(tempStr.find("(") + 1);
ReqFragment = atoll(tempStr.substr(0, tempStr.find(")")).c_str());
-#if DEBUG >= 4
- printf("Quality: %s, Time %d\n", Quality.c_str(), (ReqFragment / 10000));
-#endif
std::stringstream sstream;
sstream << "s " << (ReqFragment / 10000) << "\no \n";
ss.SendNow(sstream.str().c_str());
@@ -183,9 +180,6 @@ namespace Connector_HTTP {
std::string manifest = BuildManifest(streamname, Strm.metadata);
HTTP_S.SetBody(manifest);
conn.SendNow(HTTP_S.BuildResponse("200", "OK"));
-#if DEBUG >= 3
- printf("Sent manifest\n");
-#endif
pending_manifest = false;
}else{
pending_manifest = true;
@@ -217,9 +211,6 @@ namespace Connector_HTTP {
continue;
}
ss.setBlocking(false);
-#if DEBUG >= 3
- fprintf(stderr, "Everything connected, starting to send video data...\n");
-#endif
inited = true;
}
unsigned int now = Util::epoch();
@@ -236,9 +227,6 @@ namespace Connector_HTTP {
std::string manifest = BuildManifest(streamname, Strm.metadata);
HTTP_S.SetBody(manifest);
conn.SendNow(HTTP_S.BuildResponse("200", "OK"));
-#if DEBUG >= 3
- printf("Sent manifest\n");
-#endif
pending_manifest = false;
}
if (Strm.lastType() == DTSC::PAUSEMARK){
@@ -246,9 +234,6 @@ namespace Connector_HTTP {
fprintf(stderr, "Received a %s fragment of %i bytes.\n", Strm.getPacket(0)["datatype"].asString().c_str(), FlashBufSize);
#endif
if (Flash_RequestPending > 0 && FlashBufSize){
-#if DEBUG >= 3
- fprintf(stderr, "Sending a fragment...");
-#endif
//static std::string btstrp;
//btstrp = GenerateBootstrap(streamname, Strm.metadata, ReqFragment, FlashBufTime, Strm.getPacket(0)["time"]);
HTTP_S.Clean();
@@ -350,9 +335,6 @@ namespace Connector_HTTP {
FlashBuf.pop_front();
}
Flash_RequestPending--;
-#if DEBUG >= 3
- fprintf(stderr, "Done\n");
-#endif
}
FlashBuf.clear();
FlashBufSize = 0;
@@ -369,9 +351,6 @@ namespace Connector_HTTP {
std::string manifest = BuildManifest(streamname, Strm.metadata);
HTTP_S.SetBody(manifest);
conn.SendNow(HTTP_S.BuildResponse("200", "OK"));
-#if DEBUG >= 3
- printf("Sent manifest\n");
-#endif
pending_manifest = false;
}
}
@@ -405,7 +384,7 @@ int main(int argc, char ** argv){
if (myid == 0){ //if new child, start MAINHANDLER
return Connector_HTTP::Connector_HTTP_Dynamic(S);
}else{ //otherwise, do nothing or output debugging text
-#if DEBUG >= 3
+#if DEBUG >= 5
fprintf(stderr, "Spawned new process %i for socket %i\n", (int)myid, S.getSocket());
#endif
}
diff --git a/src/conn_rtmp.cpp b/src/conn_rtmp.cpp
index ab764eb0..53346c9e 100644
--- a/src/conn_rtmp.cpp
+++ b/src/conn_rtmp.cpp
@@ -67,11 +67,11 @@ int Connector_RTMP::Connector_RTMP(Socket::Connection conn){
}
Socket.Received().remove(1536);
RTMPStream::rec_cnt += 1536;
-#if DEBUG >= 4
+#if DEBUG >= 5
fprintf(stderr, "Handshake succcess!\n");
#endif
}else{
-#if DEBUG >= 1
+#if DEBUG >= 5
fprintf(stderr, "Handshake fail!\n");
#endif
return 0;
@@ -99,9 +99,6 @@ int Connector_RTMP::Connector_RTMP(Socket::Connection conn){
break;
}
SS.setBlocking(false);
-#if DEBUG >= 3
- fprintf(stderr, "Everything connected, starting to send video data...\n");
-#endif
SS.SendNow("p\n");
inited = true;
}
@@ -213,18 +210,18 @@ void Connector_RTMP::parseChunk(Socket::Buffer & inbuffer){
break; //happens when connection breaks unexpectedly
case 1: //set chunk size
RTMPStream::chunk_rec_max = ntohl(*(int*)next.data.c_str());
-#if DEBUG >= 4
+#if DEBUG >= 5
fprintf(stderr, "CTRL: Set chunk size: %i\n", RTMPStream::chunk_rec_max);
#endif
break;
case 2: //abort message - we ignore this one
-#if DEBUG >= 4
+#if DEBUG >= 5
fprintf(stderr, "CTRL: Abort message\n");
#endif
//4 bytes of stream id to drop
break;
case 3: //ack
-#if DEBUG >= 4
+#if DEBUG >= 8
fprintf(stderr, "CTRL: Acknowledgement\n");
#endif
RTMPStream::snd_window_at = ntohl(*(int*)next.data.c_str());
@@ -241,7 +238,7 @@ void Connector_RTMP::parseChunk(Socket::Buffer & inbuffer){
//6 = pingrequest, 4 bytes data
//7 = pingresponse, 4 bytes data
//we don't need to process this
-#if DEBUG >= 4
+#if DEBUG >= 5
short int ucmtype = ntohs(*(short int*)next.data.c_str());
switch (ucmtype){
case 0:
@@ -273,7 +270,7 @@ void Connector_RTMP::parseChunk(Socket::Buffer & inbuffer){
}
break;
case 5: //window size of other end
-#if DEBUG >= 4
+#if DEBUG >= 5
fprintf(stderr, "CTRL: Window size\n");
#endif
RTMPStream::rec_window_size = ntohl(*(int*)next.data.c_str());
@@ -281,7 +278,7 @@ void Connector_RTMP::parseChunk(Socket::Buffer & inbuffer){
Socket.Send(RTMPStream::SendCTL(3, RTMPStream::rec_cnt)); //send ack (msg 3)
break;
case 6:
-#if DEBUG >= 4
+#if DEBUG >= 5
fprintf(stderr, "CTRL: Set peer bandwidth\n");
#endif
//4 bytes window size, 1 byte limit type (ignored)
@@ -311,34 +308,34 @@ void Connector_RTMP::parseChunk(Socket::Buffer & inbuffer){
}
}
}else{
-#if DEBUG >= 4
+#if DEBUG >= 5
fprintf(stderr, "Received useless media data\n");
#endif
Socket.close();
}
break;
case 15:
-#if DEBUG >= 4
+#if DEBUG >= 5
fprintf(stderr, "Received AFM3 data message\n");
#endif
break;
case 16:
-#if DEBUG >= 4
+#if DEBUG >= 5
fprintf(stderr, "Received AFM3 shared object\n");
#endif
break;
case 17: {
-#if DEBUG >= 4
+#if DEBUG >= 5
fprintf(stderr, "Received AFM3 command message\n");
#endif
if (next.data[0] != 0){
next.data = next.data.substr(1);
amf3data = AMF::parse3(next.data);
-#if DEBUG >= 4
+#if DEBUG >= 5
amf3data.Print();
#endif
}else{
-#if DEBUG >= 4
+#if DEBUG >= 5
fprintf(stderr, "Received AFM3-0 command message\n");
#endif
next.data = next.data.substr(1);
@@ -348,7 +345,7 @@ void Connector_RTMP::parseChunk(Socket::Buffer & inbuffer){
}
break;
case 19:
-#if DEBUG >= 4
+#if DEBUG >= 5
fprintf(stderr, "Received AFM0 shared object\n");
#endif
break;
@@ -358,7 +355,7 @@ void Connector_RTMP::parseChunk(Socket::Buffer & inbuffer){
}
break;
case 22:
-#if DEBUG >= 4
+#if DEBUG >= 5
fprintf(stderr, "Received aggregate message\n");
#endif
break;
@@ -373,7 +370,7 @@ void Connector_RTMP::parseChunk(Socket::Buffer & inbuffer){
} //parseChunk
void Connector_RTMP::sendCommand(AMF::Object & amfreply, int messagetype, int stream_id){
-#if DEBUG >= 4
+#if DEBUG >= 8
std::cerr << amfreply.Print() << std::endl;
#endif
if (messagetype == 17){
@@ -384,10 +381,10 @@ void Connector_RTMP::sendCommand(AMF::Object & amfreply, int messagetype, int st
} //sendCommand
void Connector_RTMP::parseAMFCommand(AMF::Object & amfdata, int messagetype, int stream_id){
-#if DEBUG >= 4
+#if DEBUG >= 5
fprintf(stderr, "Received command: %s\n", amfdata.Print().c_str());
#endif
-#if DEBUG >= 3
+#if DEBUG >= 8
fprintf(stderr, "AMF0 command: %s\n", amfdata.getContentP(0)->StrValue().c_str());
#endif
if (amfdata.getContentP(0)->StrValue() == "connect"){
@@ -395,7 +392,7 @@ void Connector_RTMP::parseAMFCommand(AMF::Object & amfdata, int messagetype, int
if (amfdata.getContentP(2)->getContentP("objectEncoding")){
objencoding = amfdata.getContentP(2)->getContentP("objectEncoding")->NumValue();
}
-#if DEBUG >= 4
+#if DEBUG >= 6
int tmpint;
if (amfdata.getContentP(2)->getContentP("videoCodecs")){
tmpint = (int)amfdata.getContentP(2)->getContentP("videoCodecs")->NumValue();
@@ -489,9 +486,6 @@ void Connector_RTMP::parseAMFCommand(AMF::Object & amfdata, int messagetype, int
SS.Send(Socket.getHost().c_str());
SS.Send("\n");
nostats = true;
-#if DEBUG >= 4
- fprintf(stderr, "Connected to buffer, starting to send data...\n");
-#endif
}
//send a _result reply
AMF::Object amfreply("container", AMF::AMF0_DDV_CONTAINER);
@@ -611,7 +605,7 @@ int main(int argc, char ** argv){
if (myid == 0){ //if new child, start MAINHANDLER
return Connector_RTMP::Connector_RTMP(S);
}else{ //otherwise, do nothing or output debugging text
-#if DEBUG >= 3
+#if DEBUG >= 5
fprintf(stderr, "Spawned new process %i for socket %i\n", (int)myid, S.getSocket());
#endif
}
diff --git a/src/conn_ts.cpp b/src/conn_ts.cpp
index f7547668..230521e3 100644
--- a/src/conn_ts.cpp
+++ b/src/conn_ts.cpp
@@ -54,9 +54,6 @@ int TS_Handler(Socket::Connection conn, std::string streamname){
break;
}
ss.SendNow("p\n");
-#if DEBUG >= 3
- fprintf(stderr, "Everything connected, starting to send video data...\n");
-#endif
inited = true;
}
if (ss.spool()){
@@ -175,7 +172,6 @@ int TS_Handler(Socket::Connection conn, std::string streamname){
}
}
}
- fprintf(stderr, "Exiting\n");
return 0;
}
@@ -194,12 +190,11 @@ int main(int argc, char ** argv){
while (server_socket.connected() && conf.is_active){
Socket::Connection S = server_socket.accept();
if (S.connected()){ //check if the new connection is valid
- fprintf(stderr, "Incoming connection\n");
pid_t myid = fork();
if (myid == 0){ //if new child, start MAINHANDLER
return TS_Handler(S, conf.getString("streamname"));
}else{ //otherwise, do nothing or output debugging text
-#if DEBUG >= 3
+#if DEBUG >= 5
fprintf(stderr, "Spawned new process %i for socket %i\n", (int)myid, S.getSocket());
#endif
}
diff --git a/src/player.cpp b/src/player.cpp
index a73ac43f..a995c8af 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -166,9 +166,6 @@ int main(int argc, char** argv){
}
++playing;
in_out.setBlocking(false);
-#if DEBUG >= 4
- std::cerr << "Playing one keyframe" << std::endl;
-#endif
bench = Util::getMS();
}
break;
@@ -199,7 +196,7 @@ int main(int argc, char** argv){
}
if (playing == 0){
#if DEBUG >= 4
- std::cerr << "Sending pause_marker (" << (Util::getMS() - bench) << "ms)" << std::endl;
+ std::cerr << "Completed VoD request in MistPlayer (" << (Util::getMS() - bench) << "ms)" << std::endl;
#endif
pausemark["time"] = source.getJSON()["time"];
pausemark.toPacked();
@@ -220,11 +217,11 @@ int main(int argc, char** argv){
}
StatsSocket.close();
in_out.close();
-#if DEBUG >= 4
+#if DEBUG >= 5
if (Util::epoch() - lasttime < 60){
- std::cerr << "Player exited (disconnect)." << std::endl;
+ std::cerr << "MistPlayer exited (disconnect)." << std::endl;
}else{
- std::cerr << "Player exited (timeout)." << std::endl;
+ std::cerr << "MistPlayer exited (command timeout)." << std::endl;
}
#endif
return 0;