From 9e5babf9db52e64bdae60137be7696e56241fca6 Mon Sep 17 00:00:00 2001 From: xingzilong <xingzilong@454eff88-639b-444f-9e54-f578c98de674> Date: 星期五, 18 八月 2017 18:12:17 +0800 Subject: [PATCH] H264 NALU解析 并在RTSPServer判断 --- RtspFace/PL_RTSPClient.cpp | 18 +++++++++++++++++- 1 files changed, 17 insertions(+), 1 deletions(-) diff --git a/RtspFace/PL_RTSPClient.cpp b/RtspFace/PL_RTSPClient.cpp index c2bd969..5704b37 100644 --- a/RtspFace/PL_RTSPClient.cpp +++ b/RtspFace/PL_RTSPClient.cpp @@ -219,6 +219,17 @@ pm.buffSize = 0; pm.former = this; +// if(nullptr!=pm.buffer) +// { +// MB_Frame* frame = (MB_Frame*)pm.buffer; +// if (frame->type == MB_Frame::MBFT_H264_NALU) +// { +// static FILE *pFile = fopen("/data/bb1.264", "wb"); +// fwrite(frame->buffer, sizeof(char), frame->buffSize, pFile); +// fflush(pFile); +// } +// } + return true; } @@ -249,11 +260,16 @@ sprintf(tmp, "%u", param.height); client->manager->set_param(PLGP_RTSP_HEIGHT, std::string(tmp)); sprintf(tmp, "%u", param.fps); client->manager->set_param(PLGP_RTSP_FPS, std::string(tmp)); + size_t spl = 0; if (param.fmtp.find_first_of(',') != std::string::npos) { - //#todo // split fmpt to base64 of sps,pps // set to PLGP_DEC_SPS_B64 PLGP_DEC_PPS_B64 + spl = param.fmtp.find_first_of(','); + std::string _base64_sps = param.fmtp.substr(0, spl); + std::string _base64_pps = param.fmtp.substr(spl + 1, param.fmtp.length()); + client->manager->set_param(PLGP_DEC_SPS_B64,_base64_sps); + client->manager->set_param(PLGP_DEC_PPS_B64,_base64_pps); } /* -- Gitblit v1.8.0