From 6faf88ba05f174a80c68f01c0412cae9789dbc8c Mon Sep 17 00:00:00 2001 From: houxiao <houxiao@454eff88-639b-444f-9e54-f578c98de674> Date: 星期四, 17 八月 2017 17:55:01 +0800 Subject: [PATCH] aaaaa --- RtspFace/MediaHelper.cpp | 2 ++ RtspFace/PL_RTSPServer2.cpp | 9 +++++++++ RtspFace/PL_AndroidMediaCodecEncoder.cpp | 8 ++++++-- RtspFace/PL_AndroidMediaCodecDecoder_ndk.cpp | 3 ++- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/RtspFace/MediaHelper.cpp b/RtspFace/MediaHelper.cpp index 5081788..25dec53 100644 --- a/RtspFace/MediaHelper.cpp +++ b/RtspFace/MediaHelper.cpp @@ -3,6 +3,7 @@ #include <liveMedia/liveMedia.hh> #include <liveMedia/Base64.hh> +// the caller is responsible for delete[]ing. uint8_t* base64_decode(char const* in, size_t inSize, size_t& resultSize, bool trimTrailingZeros) { unsigned _resultSize = resultSize; @@ -12,6 +13,7 @@ return ret; } +// the caller is responsible for delete[]ing. char* base64_encode(char const* orig, size_t origLength) { unsigned _origLength = origLength; diff --git a/RtspFace/PL_AndroidMediaCodecDecoder_ndk.cpp b/RtspFace/PL_AndroidMediaCodecDecoder_ndk.cpp index d56500d..f7a258e 100644 --- a/RtspFace/PL_AndroidMediaCodecDecoder_ndk.cpp +++ b/RtspFace/PL_AndroidMediaCodecDecoder_ndk.cpp @@ -200,6 +200,7 @@ if (pm.buffer == nullptr) return false; +#ifdef 0 if (!in->auxIsSet) { //#todo @@ -225,8 +226,8 @@ in->auxIsSet = true; } - } +#endif MB_Frame* frame = (MB_Frame*)pm.buffer; if (frame->type != MB_Frame::MBFT_H264_NALU) diff --git a/RtspFace/PL_AndroidMediaCodecEncoder.cpp b/RtspFace/PL_AndroidMediaCodecEncoder.cpp index 94d3fea..3ce90d6 100644 --- a/RtspFace/PL_AndroidMediaCodecEncoder.cpp +++ b/RtspFace/PL_AndroidMediaCodecEncoder.cpp @@ -271,8 +271,12 @@ if (spsSize != 0) { - std::string spsStr = base64_encode(((const char*)sps) + 4, spsSize - 4);//#todo aux - std::string ppsStr = base64_encode(((const char*)pps) + 4, ppsSize - 4); + char* tmp = nullptr; + std::string spsStr = tmp = base64_encode(((const char*)sps) + 4, spsSize - 4);//#todo aux + delete[] tmp; + std::string ppsStr = tmp = base64_encode(((const char*)pps) + 4, ppsSize - 4); + delete[] tmp; + tmp = nullptr; this->manager->set_param(PLGP_ENC_SPS_B64, spsStr); this->manager->set_param(PLGP_ENC_PPS_B64, ppsStr); diff --git a/RtspFace/PL_RTSPServer2.cpp b/RtspFace/PL_RTSPServer2.cpp index 16da9fa..0506315 100644 --- a/RtspFace/PL_RTSPServer2.cpp +++ b/RtspFace/PL_RTSPServer2.cpp @@ -160,6 +160,11 @@ _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; @@ -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); -- Gitblit v1.8.0