From 51147a836955ed6ff7c111bbce89e244f0c3f27f Mon Sep 17 00:00:00 2001
From: houxiao <houxiao@454eff88-639b-444f-9e54-f578c98de674>
Date: 星期四, 17 八月 2017 16:20:05 +0800
Subject: [PATCH] aaaaa
---
RtspFace/PL_RTSPServer2.cpp | 3 ++-
RtspFace/PL_RTSPClient.cpp | 7 +++++++
RtspFace/PL_AndroidMediaCodecDecoder_ndk.cpp | 21 +++++++++++++++++++--
3 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/RtspFace/PL_AndroidMediaCodecDecoder_ndk.cpp b/RtspFace/PL_AndroidMediaCodecDecoder_ndk.cpp
index c7e624e..79a8a46 100644
--- a/RtspFace/PL_AndroidMediaCodecDecoder_ndk.cpp
+++ b/RtspFace/PL_AndroidMediaCodecDecoder_ndk.cpp
@@ -38,12 +38,15 @@
AMediaCodec* codec;
+ bool auxIsSet;
+
PL_AMCD_Internal() :
buffSize(0), buffSizeMax(sizeof(buffer)),
inputFrameCount(0), lastOutputBuffIdx(-1),
lastMbfBuffIdx(), lastMbfBuffer(),
config(),
- codec(nullptr)
+ codec(nullptr),
+ auxIsSet(false)
{
}
@@ -193,7 +196,21 @@
if (pm.buffer == nullptr)
return false;
-
+
+ if (!in->auxIsSet)
+ {
+ //#todo
+ // find PLGP_DEC_SPS_B64 PLGP_DEC_PPS_B64 in this->manager else nothing
+ // base64 decode
+
+ //AMediaFormat* format = AMediaCodec_getOutputFormat(in->codec);
+ //AMediaFormat_setBuffer(format, "csd-1", pps, sizeof(pps)); // pps
+ //AMediaCodec_setParameters
+ // #todo delete format
+
+ in->auxIsSet = true;
+ }
+
MB_Frame* frame = (MB_Frame*)pm.buffer;
if (frame->type != MB_Frame::MBFT_H264_NALU)
{
diff --git a/RtspFace/PL_RTSPClient.cpp b/RtspFace/PL_RTSPClient.cpp
index 7bcf9d9..c2bd969 100644
--- a/RtspFace/PL_RTSPClient.cpp
+++ b/RtspFace/PL_RTSPClient.cpp
@@ -249,6 +249,13 @@
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));
+ 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
+ }
+
/*
std::string fmtp(client->manager->get_param(PLGP_RTSP_FMTP));
if (fmtp.empty())
diff --git a/RtspFace/PL_RTSPServer2.cpp b/RtspFace/PL_RTSPServer2.cpp
index b082afe..16da9fa 100644
--- a/RtspFace/PL_RTSPServer2.cpp
+++ b/RtspFace/PL_RTSPServer2.cpp
@@ -326,7 +326,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