From 01284323eb737acef58a3d8a57cec82d5c5f6fe8 Mon Sep 17 00:00:00 2001 From: Zhou Weimin Date: Sat, 12 Sep 2020 13:45:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BF=BD=E7=95=A5AUD=E5=B8=A7;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Common/MultiMediaSourceMuxer.cpp | 2 +- src/Extension/H264.h | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/Common/MultiMediaSourceMuxer.cpp b/src/Common/MultiMediaSourceMuxer.cpp index 46ae3bc3..b7b4942e 100644 --- a/src/Common/MultiMediaSourceMuxer.cpp +++ b/src/Common/MultiMediaSourceMuxer.cpp @@ -378,7 +378,7 @@ void MultiMediaSourceMuxer::inputFrame(const Frame::Ptr &frame_in) { bool MultiMediaSourceMuxer::isEnabled(){ #if defined(ENABLE_RTPPROXY) - return _muxer->isEnabled() || _ps_rtp_sender + return (_muxer->isEnabled() || _ps_rtp_sender); #endif //ENABLE_RTPPROXY return _muxer->isEnabled(); } diff --git a/src/Extension/H264.h b/src/Extension/H264.h index 1f1cdf10..16672a33 100644 --- a/src/Extension/H264.h +++ b/src/Extension/H264.h @@ -30,10 +30,11 @@ public: typedef std::shared_ptr Ptr; typedef enum { - NAL_SPS = 7, - NAL_PPS = 8, NAL_IDR = 5, NAL_SEI = 6, + NAL_SPS = 7, + NAL_PPS = 8, + NAL_AUD = 9, } NalType; H264Frame(){ @@ -179,7 +180,8 @@ public: */ void inputFrame(const Frame::Ptr &frame) override{ int type = H264_TYPE(*((uint8_t *)frame->data() + frame->prefixSize())); - if(type == H264Frame::NAL_SPS || type == H264Frame::NAL_PPS || type == H264Frame::NAL_SEI){ + if(type == H264Frame::NAL_SPS || type == H264Frame::NAL_PPS || type == H264Frame::NAL_SEI || + type == H264Frame::NAL_AUD){ //有些设备会把SPS PPS IDR帧当做一个帧打包,所以我们要split一下 splitH264(frame->data(), frame->size(), frame->prefixSize(), [&](const char *ptr, int len, int prefix) { H264FrameInternal::Ptr sub_frame = std::make_shared(frame, (char *)ptr, len, prefix); @@ -224,6 +226,10 @@ private: VideoTrack::inputFrame(frame); } break; + case H264Frame::NAL_AUD:{ + //忽略AUD帧; + } + break; default: VideoTrack::inputFrame(frame); @@ -326,4 +332,4 @@ private: }; }//namespace mediakit -#endif //ZLMEDIAKIT_H264_H \ No newline at end of file +#endif //ZLMEDIAKIT_H264_H