diff --git a/release/mac/Release/MediaServer b/release/mac/Release/MediaServer index a6c6cc71..52972b45 100755 Binary files a/release/mac/Release/MediaServer and b/release/mac/Release/MediaServer differ diff --git a/release/mac/Release/libflv.a b/release/mac/Release/libflv.a index 7271c9a2..01cefb84 100644 Binary files a/release/mac/Release/libflv.a and b/release/mac/Release/libflv.a differ diff --git a/release/mac/Release/libjsoncpp.a b/release/mac/Release/libjsoncpp.a index 7ce43685..ba198124 100644 Binary files a/release/mac/Release/libjsoncpp.a and b/release/mac/Release/libjsoncpp.a differ diff --git a/release/mac/Release/libmov.a b/release/mac/Release/libmov.a index 7baaf5d2..851f0992 100644 Binary files a/release/mac/Release/libmov.a and b/release/mac/Release/libmov.a differ diff --git a/release/mac/Release/libmpeg.a b/release/mac/Release/libmpeg.a index bf592422..efa4a05b 100644 Binary files a/release/mac/Release/libmpeg.a and b/release/mac/Release/libmpeg.a differ diff --git a/release/mac/Release/libzlmediakit.a b/release/mac/Release/libzlmediakit.a index 95a8b4a7..25137b64 100644 Binary files a/release/mac/Release/libzlmediakit.a and b/release/mac/Release/libzlmediakit.a differ diff --git a/release/mac/Release/libzltoolkit.a b/release/mac/Release/libzltoolkit.a index cd16d54d..ef27844d 100644 Binary files a/release/mac/Release/libzltoolkit.a and b/release/mac/Release/libzltoolkit.a differ diff --git a/release/mac/Release/test_benchmark b/release/mac/Release/test_benchmark index 0d834e47..8bb48093 100755 Binary files a/release/mac/Release/test_benchmark and b/release/mac/Release/test_benchmark differ diff --git a/release/mac/Release/test_httpApi b/release/mac/Release/test_httpApi index 6dfa9efd..8f0bb289 100755 Binary files a/release/mac/Release/test_httpApi and b/release/mac/Release/test_httpApi differ diff --git a/release/mac/Release/test_httpClient b/release/mac/Release/test_httpClient index 81a292bc..34de1647 100755 Binary files a/release/mac/Release/test_httpClient and b/release/mac/Release/test_httpClient differ diff --git a/release/mac/Release/test_player b/release/mac/Release/test_player index d73ef2df..a95a4b93 100755 Binary files a/release/mac/Release/test_player and b/release/mac/Release/test_player differ diff --git a/release/mac/Release/test_pusher b/release/mac/Release/test_pusher index 2b2fa37a..93dd60a1 100755 Binary files a/release/mac/Release/test_pusher and b/release/mac/Release/test_pusher differ diff --git a/release/mac/Release/test_pusherMp4 b/release/mac/Release/test_pusherMp4 index 153a9409..44ad50f1 100755 Binary files a/release/mac/Release/test_pusherMp4 and b/release/mac/Release/test_pusherMp4 differ diff --git a/release/mac/Release/test_server b/release/mac/Release/test_server index d173faf3..8b6d5e48 100755 Binary files a/release/mac/Release/test_server and b/release/mac/Release/test_server differ diff --git a/src/Extension/H264Rtp.cpp b/src/Extension/H264Rtp.cpp index 8a961e34..f79da18e 100644 --- a/src/Extension/H264Rtp.cpp +++ b/src/Extension/H264Rtp.cpp @@ -265,11 +265,22 @@ void H264RtpEncoder::inputFrame(const Frame::Ptr &frame) { } else { s_e_r_type = s_e_r_Mid + naluType; } - memcpy(_aucSectionBuf, &f_nri_type, 1); - memcpy(_aucSectionBuf + 1, &s_e_r_type, 1); - memcpy(_aucSectionBuf + 2, (unsigned char *) pcData + nOffset, iSize); + + { + //传入nullptr先不做payload的内存拷贝 + auto rtp = makeRtp(getTrackType(), nullptr, iSize + 2, mark, uiStamp); + //rtp payload 负载部分 + uint8_t *payload = (uint8_t*)rtp->data() + rtp->offset; + //FU-A 第1个字节 + memcpy(payload, &f_nri_type, 1); + //FU-A 第2个字节 + memcpy(payload + 1, &s_e_r_type, 1); + //H264 数据 + memcpy(payload + 2, (unsigned char *) pcData + nOffset, iSize); + //输入到rtp环形缓存 + RtpCodec::inputRtp(rtp,bFirst && naluType == H264Frame::NAL_IDR); + } nOffset += iSize; - makeH264Rtp(naluType,_aucSectionBuf, iSize + 2, mark,bFirst, uiStamp); bFirst = false; } } else { diff --git a/src/Extension/H264Rtp.h b/src/Extension/H264Rtp.h index 94ad7c46..5ccac81d 100644 --- a/src/Extension/H264Rtp.h +++ b/src/Extension/H264Rtp.h @@ -97,8 +97,6 @@ public: void inputFrame(const Frame::Ptr &frame) override; private: void makeH264Rtp(int nal_type,const void *pData, unsigned int uiLen, bool bMark, bool first_packet, uint32_t uiStamp); -private: - unsigned char _aucSectionBuf[1600]; }; }//namespace mediakit{ diff --git a/src/Extension/H265Rtp.cpp b/src/Extension/H265Rtp.cpp index 4fc00042..e5c701b2 100644 --- a/src/Extension/H265Rtp.cpp +++ b/src/Extension/H265Rtp.cpp @@ -194,13 +194,24 @@ void H265RtpEncoder::inputFrame(const Frame::Ptr &frame) { s_e_type = naluType; } - //FU type - _aucSectionBuf[0] = 49 << 1; - _aucSectionBuf[1] = 1; - _aucSectionBuf[2] = s_e_type; - memcpy(_aucSectionBuf + 3, pcData + nOffset, maxSize); + { + //传入nullptr先不做payload的内存拷贝 + auto rtp = makeRtp(getTrackType(), nullptr, maxSize + 3, mark, uiStamp); + //rtp payload 负载部分 + uint8_t *payload = (uint8_t*)rtp->data() + rtp->offset; + //FU-A 第1个字节 + payload[0] = 49 << 1; + //FU-A 第2个字节貌似固定为1 + payload[1] = 1; + //FU-A 第3个字节 + payload[2] = s_e_type; + //H265 数据 + memcpy(payload + 3,pcData + nOffset, maxSize); + //输入到rtp环形缓存 + RtpCodec::inputRtp(rtp,bFirst && H265Frame::isKeyFrame(naluType)); + } + nOffset += maxSize; - makeH265Rtp(naluType,_aucSectionBuf, maxSize + 3, mark,bFirst, uiStamp); bFirst = false; } } else { diff --git a/src/Extension/H265Rtp.h b/src/Extension/H265Rtp.h index fbe84031..8b51f880 100644 --- a/src/Extension/H265Rtp.h +++ b/src/Extension/H265Rtp.h @@ -98,8 +98,6 @@ public: void inputFrame(const Frame::Ptr &frame) override; private: void makeH265Rtp(int nal_type,const void *pData, unsigned int uiLen, bool bMark, bool first_packet,uint32_t uiStamp); -private: - unsigned char _aucSectionBuf[1600]; }; }//namespace mediakit{ diff --git a/src/Rtsp/RtpCodec.cpp b/src/Rtsp/RtpCodec.cpp index fe1b6a5a..9e5d5a3c 100644 --- a/src/Rtsp/RtpCodec.cpp +++ b/src/Rtsp/RtpCodec.cpp @@ -49,8 +49,11 @@ RtpPacket::Ptr RtpInfo::makeRtp(TrackType type, const void* data, unsigned int l memcpy(&pucRtp[8], &ts, 4); //ssrc memcpy(&pucRtp[12], &sc, 4); - //playload - memcpy(&pucRtp[16], data, len); + + if(data){ + //playload + memcpy(&pucRtp[16], data, len); + } rtppkt->PT = _ui8PlayloadType; rtppkt->interleaved = _ui8Interleaved;