From 5cf652629fb40796cd2e0ab17c3617ed52365473 Mon Sep 17 00:00:00 2001
From: pans <pans@454eff88-639b-444f-9e54-f578c98de674>
Date: 星期五, 18 八月 2017 10:32:05 +0800
Subject: [PATCH] capnp client fix bug

---
 RtspFace/PL_RTSPServer2.cpp |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/RtspFace/PL_RTSPServer2.cpp b/RtspFace/PL_RTSPServer2.cpp
index adc8d6c..0506315 100644
--- a/RtspFace/PL_RTSPServer2.cpp
+++ b/RtspFace/PL_RTSPServer2.cpp
@@ -160,13 +160,18 @@
 			_this->lastBuffer = nullptr;
 		}
 
+		//#todo
+		//find frameQueue->Seek is pps/sps
+		// if not: send bufferred pps , return;
+
+
 		_this->lastBuffer = _this->in->frameQueue->Dequeue();
 		if (_this->lastBuffer == nullptr)
 			return false;
 
-		buffer = _this->lastBuffer->buffer;
-		buffSize = _this->lastBuffer->buffSize;
-		LOG_WARN << "sizeS=" << buffSize << LOG_ENDL;
+		buffer = _this->lastBuffer->buffer + 4; // #todo send nalu
+		buffSize = _this->lastBuffer->buffSize - 4;
+		//LOG_WARN << "sizeS=" << buffSize << LOG_ENDL;
 
 		//LOG_INFO << "DeliverFrameCallback buffSize=" << buffSize << LOG_ENDL;
 		//static size_t f = 0;
@@ -281,6 +286,10 @@
 		}
 	}
 
+//#todo
+	// find if is pps/sps
+	// buffer the frame into RTSPServer2_Internal
+
 	while (in->config.payBlockFullQueue && in->frameQueue->Full())
 	{
 		int ret = pthread_mutex_lock(in->queue_full_mutex);
@@ -300,7 +309,7 @@
 	if (frame->buffer == nullptr || frame->buffSize == 0)
 		return false;
 
-	LOG_WARN << "sizeR=" << frame->buffSize << LOG_ENDL;
+	//LOG_WARN << "sizeR=" << frame->buffSize << LOG_ENDL;
 
 	ScopeLocker<pthread_mutex_t>(in->queue_mutex);
 	//if (in->frameQueue->Full())
@@ -326,7 +335,8 @@
 
 	//static size_t f = 0;
 	//static FILE *pFile = fopen("/data/aa.264", "wb");
-	//fwrite(qbuff->buffer, sizeof(char), frame->buffSize, pFile);
+	//fwrite(qbuff->buffer, sizeof(char), qbuff->buffSize, pFile);
+	//fflush(pFile);
 	//if (++f > 400){
 	//	fclose(pFile);
 	//	exit(0);

--
Gitblit v1.8.0