From 41bc5a329c73e3b43695f73f11c47c97c44cc1b6 Mon Sep 17 00:00:00 2001 From: chenke <chenke@454eff88-639b-444f-9e54-f578c98de674> Date: 星期四, 20 七月 2017 09:45:41 +0800 Subject: [PATCH] --- RtspFace/PL_RTSPServer.cpp | 22 +++++++++++++--------- 1 files changed, 13 insertions(+), 9 deletions(-) diff --git a/RtspFace/PL_RTSPServer.cpp b/RtspFace/PL_RTSPServer.cpp index 6c6394b..d705a8b 100644 --- a/RtspFace/PL_RTSPServer.cpp +++ b/RtspFace/PL_RTSPServer.cpp @@ -1,8 +1,9 @@ #include "PL_RTSPServer.h" #include "MaterialBuffer.h" +#include "logger.h" -#include <liveMedia.hh> -#include <BasicUsageEnvironment.hh> +#include <liveMedia/liveMedia.hh> +#include <BasicUsageEnvironment/BasicUsageEnvironment.hh> #include "FFmpegRTSPServer/IEncoder.h" #include "FFmpegRTSPServer/LiveRTSPServer.h" @@ -112,7 +113,7 @@ *FrameBuffer = pBuffer; *FrameSize = newBufferSize; - printf("send frame size=%u\n", in.buffSize); + LOG_DEBUG << "send frame size=" << in.buffSize << std::endl; } virtual char ReleaseFrame() @@ -124,7 +125,7 @@ int ret = pthread_mutex_unlock(in.frame_mutex); if(ret != 0) { - printf("pthread_mutex_unlock frame_mutex: %s/n", strerror(ret)); + LOG_WARN << "pthread_mutex_unlock frame_mutex: " << strerror(ret) << std::endl; return 0; } } @@ -142,7 +143,7 @@ int ret = pthread_mutex_lock(in.frame_mutex); if(ret != 0) { - printf("pthread_mutex_lock frame_mutex: %s/n", strerror(ret)); + LOG_WARN << "pthread_mutex_lock frame_mutex: " << strerror(ret) << std::endl; return; } } @@ -196,7 +197,7 @@ int ret = pthread_create(&(in->live_daemon_thid), NULL, live_daemon_thd, in); if(ret != 0) { - printf("pthread_create: %s/n", strerror(ret)); + LOG_ERROR << "pthread_create: " << strerror(ret) << std::endl; return false; } @@ -214,19 +215,21 @@ { RTSPServer_Internal* in = (RTSPServer_Internal*)internal; - if (pm.buffer == nullptr || pm.buffSize <= 0) + if (pm.buffer == nullptr) return false; if (pm.type != PipeMaterial::PMT_FRAME) { - printf("PL_RTSPServer::pay only support PMT_FRAME\n"); + LOG_ERROR << "PL_RTSPServer::pay only support PMT_FRAME" << std::endl; return false; } if (in->buffSize > 0) - printf("PL_RTSPServer::pay may lost data size=%u\n", in->buffSize); + LOG_WARN << "PL_RTSPServer::pay may lost data size=" << in->buffSize << std::endl; MB_Frame* frame = (MB_Frame*)pm.buffer; + if (frame->buffer == nullptr) + return false; memcpy(in->buffer, frame->buffer, frame->buffSize); in->buffSize = frame->buffSize; @@ -241,6 +244,7 @@ { RTSPServer_Internal* in = (RTSPServer_Internal*)internal; + pm.type = PipeMaterial::PMT_NONE; pm.buffer = nullptr; pm.buffSize = 0; pm.former = this; -- Gitblit v1.8.0