From 5e9814a090f20c2b9c39d6efdc9a732b6097ee7d Mon Sep 17 00:00:00 2001
From: houxiao <houxiao@454eff88-639b-444f-9e54-f578c98de674>
Date: 星期一, 24 七月 2017 20:12:53 +0800
Subject: [PATCH] aaa

---
 RtspFace/live555/testProgs/testRTSPClient.hpp |   72 ++++++++++++++++++++----------------
 1 files changed, 40 insertions(+), 32 deletions(-)

diff --git a/RtspFace/live555/testProgs/testRTSPClient.hpp b/RtspFace/live555/testProgs/testRTSPClient.hpp
index c1c4765..47dccd2 100644
--- a/RtspFace/live555/testProgs/testRTSPClient.hpp
+++ b/RtspFace/live555/testProgs/testRTSPClient.hpp
@@ -36,6 +36,8 @@
 // Define the size of the buffer that we'll use:
 #define DUMMY_SINK_RECEIVE_BUFFER_SIZE 1920*1080*3//#todo
 
+#define INCREASE_RECEIVE_BUFFER_TO 8000000
+
 // If you don't want to see debugging output for each received frame, then comment out the following line:
 //#define DEBUG_PRINT_EACH_RECEIVED_FRAME 1
 //#define DEBUG_PRINT_NPT 1
@@ -302,44 +304,50 @@
 
 	scs.subsession = scs.iter->next();
 	if (scs.subsession != NULL)
+	{
+		if (_ourRTSPClient->desiredPortNum != 0)
 		{
-			if (_ourRTSPClient->desiredPortNum != 0)
-			{
-				scs.subsession->setClientPortNum(_ourRTSPClient->desiredPortNum);
-                _ourRTSPClient->desiredPortNum += 2;
-			}
-
-			if (!scs.subsession->initiate())
-				{
-					LOG_ERROR << *rtspClient << "Failed to initiate the \"" << *scs.subsession << "\" subsession: " << env.getResultMsg() << LOG_ENDL;
-					setupNextSubsession(rtspClient); // give up on this subsession; go to the next one
-				}
-			else
-				{
-					LOG_INFO <<  *rtspClient << "Initiated the \"" << *scs.subsession << "\" subsession (" << LOG_ENDL;
-					if (scs.subsession->rtcpIsMuxed())
-						LOG_INFO <<  "client port " << scs.subsession->clientPortNum() << LOG_ENDL;
-					else
-						LOG_INFO <<  "client ports " << scs.subsession->clientPortNum() << "-" << scs.subsession->clientPortNum()+1 << LOG_ENDL;
-					LOG_INFO <<  ")" << LOG_ENDL;
-
-					// Continue setting up this subsession, by sending a RTSP "SETUP" command:
-					rtspClient->sendSetupCommand(*scs.subsession, continueAfterSETUP, False, _ourRTSPClient->rtspConfig.requestStreamingOverTcp);
-				}
-			return;
+			scs.subsession->setClientPortNum(_ourRTSPClient->desiredPortNum);
+			_ourRTSPClient->desiredPortNum += 2;
 		}
+
+		if (!scs.subsession->initiate())
+		{
+			LOG_ERROR << *rtspClient << "Failed to initiate the \"" << *scs.subsession << "\" subsession: " << env.getResultMsg() << LOG_ENDL;
+			setupNextSubsession(rtspClient); // give up on this subsession; go to the next one
+		}
+		else
+		{
+			LOG_INFO <<  *rtspClient << "Initiated the \"" << *scs.subsession << "\" subsession (" << LOG_ENDL;
+			if (scs.subsession->rtcpIsMuxed())
+				LOG_INFO <<  "client port " << scs.subsession->clientPortNum() << LOG_ENDL;
+			else
+				LOG_INFO <<  "client ports " << scs.subsession->clientPortNum() << "-" << scs.subsession->clientPortNum()+1 << LOG_ENDL;
+			LOG_INFO <<  ")" << LOG_ENDL;
+
+#ifdef INCREASE_RECEIVE_BUFFER_TO
+			//sysctl net.core.rmem_max=40000000
+			if (INCREASE_RECEIVE_BUFFER_TO > 0)
+				increaseReceiveBufferTo(env, scs.subsession->rtpSource()->RTPgs()->socketNum(), INCREASE_RECEIVE_BUFFER_TO);
+#endif
+
+			// Continue setting up this subsession, by sending a RTSP "SETUP" command:
+			rtspClient->sendSetupCommand(*scs.subsession, continueAfterSETUP, False, _ourRTSPClient->rtspConfig.requestStreamingOverTcp);
+		}
+		return;
+	}
 
 	// We've finished setting up all of the subsessions.  Now, send a RTSP "PLAY" command to start the streaming:
 	if (scs.session->absStartTime() != NULL)
-		{
-			// Special case: The stream is indexed by 'absolute' time, so send an appropriate "PLAY" command:
-			rtspClient->sendPlayCommand(*scs.session, continueAfterPLAY, scs.session->absStartTime(), scs.session->absEndTime());
-		}
+	{
+		// Special case: The stream is indexed by 'absolute' time, so send an appropriate "PLAY" command:
+		rtspClient->sendPlayCommand(*scs.session, continueAfterPLAY, scs.session->absStartTime(), scs.session->absEndTime());
+	}
 	else
-		{
-			scs.duration = scs.session->playEndTime() - scs.session->playStartTime();
-			rtspClient->sendPlayCommand(*scs.session, continueAfterPLAY);
-		}
+	{
+		scs.duration = scs.session->playEndTime() - scs.session->playStartTime();
+		rtspClient->sendPlayCommand(*scs.session, continueAfterPLAY);
+	}
 }
 
 void continueAfterSETUP(RTSPClient* rtspClient, int resultCode, char* resultString)

--
Gitblit v1.8.0