From d54c54ed64f3766aaa4584fd7d317fcc98812bc4 Mon Sep 17 00:00:00 2001
From: pans <pans@454eff88-639b-444f-9e54-f578c98de674>
Date: 星期二, 27 十二月 2016 15:33:33 +0800
Subject: [PATCH] 

---
 RtspFace/PL_RTSPClient.cpp |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/RtspFace/PL_RTSPClient.cpp b/RtspFace/PL_RTSPClient.cpp
index 1ed98ee..41dad6a 100644
--- a/RtspFace/PL_RTSPClient.cpp
+++ b/RtspFace/PL_RTSPClient.cpp
@@ -5,11 +5,11 @@
 void rtsp_client_fmtp_callback(void* arg, const char* val);
 void rtsp_client_frame_callback(void* arg, uint8_t* buffer, size_t buffSize);
 void rtsp_client_continue_callback(void* arg);
-#include "testRTSPClient.hpp"
+//struct RTSPConfig;
+#include "live555/testProgs/testRTSPClient.hpp"
 
 struct RTSPClient_Internal
 {
-	PL_RTSPClient* client;
 	RTSPConfig rtspConfig;
 	pthread_t live_daemon_thid;
 	char eventLoopWatchVariable;
@@ -21,7 +21,7 @@
 	size_t lastBuffSize;
 	
 	RTSPClient_Internal() : 
-		client(nullptr), rtspConfig(), live_daemon_thid(0), 
+		rtspConfig(), live_daemon_thid(0), 
 		eventLoopWatchVariable(0), live_daemon_running(false), 
 		frame_mutex(new pthread_mutex_t), continue_mutex(new pthread_mutex_t), 
 		lastBuffer(nullptr), lastBuffSize(0)
@@ -36,20 +36,21 @@
 		{
 			pthread_mutex_destroy(frame_mutex);
 			delete frame_mutex;
+			frame_mutex = nullptr;
 		}
 		
 		if (continue_mutex != nullptr)
 		{
 			pthread_mutex_destroy(continue_mutex);
 			delete continue_mutex;
+			continue_mutex = nullptr;
 		}
 	}
 	
 	void reset()
 	{
-		client = nullptr;
-		rtspConfig.progName = "";
-		rtspConfig.rtspURL = "";
+		RTSPConfig _rtspConfig;
+		rtspConfig = _rtspConfig;
 		live_daemon_thid = 0;
 		eventLoopWatchVariable = 0;
 		live_daemon_running = false;
@@ -58,6 +59,7 @@
 		{
 			pthread_mutex_destroy(frame_mutex);
 			delete frame_mutex;
+			frame_mutex = nullptr;
 		}
 		
 		frame_mutex = new pthread_mutex_t;
@@ -67,6 +69,7 @@
 		{
 			pthread_mutex_destroy(continue_mutex);
 			delete continue_mutex;
+			continue_mutex = nullptr;
 		}
 		
 		continue_mutex = new pthread_mutex_t;
@@ -77,7 +80,7 @@
 	}
 };
 
-void* live_daemon_thd(void* arg)
+static void* live_daemon_thd(void* arg)
 {
 	RTSPClient_Internal* in = (RTSPClient_Internal*)arg;
 	
@@ -86,7 +89,7 @@
 
 	usage(*env, in->rtspConfig.progName.c_str());
 	
-	openURL(*env, in->client, in->rtspConfig.progName.c_str(), in->rtspConfig.rtspURL.c_str());
+	openURL(*env, in->rtspConfig);
 	
 	in->live_daemon_running = true;
 	env->taskScheduler().doEventLoop(&(in->eventLoopWatchVariable));
@@ -116,8 +119,8 @@
 	const RTSPConfig* config = reinterpret_cast<const RTSPConfig*>(args);
 	RTSPClient_Internal* in = (RTSPClient_Internal*)internal;
 	in->reset();
-	in->client = this;
 	in->rtspConfig = *config;
+	in->rtspConfig.args = this;
 	
 	int ret = pthread_mutex_lock(in->frame_mutex);
 	if(ret != 0)

--
Gitblit v1.8.0