From 46d1d809544fd54c00f757adcd58b0e3951350ac Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Thu, 21 Sep 2017 16:51:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=85=BC=E5=AE=B9=E6=80=A7?= =?UTF-8?q?=E9=80=82=E9=85=8D=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Rtmp/RtmpPlayerImp.h | 4 +++- src/Rtsp/RtpParser.cpp | 3 +++ src/Rtsp/Rtsp.cpp | 8 +++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Rtmp/RtmpPlayerImp.h b/src/Rtmp/RtmpPlayerImp.h index 720bd63c..df90e0cd 100644 --- a/src/Rtmp/RtmpPlayerImp.h +++ b/src/Rtmp/RtmpPlayerImp.h @@ -51,7 +51,9 @@ private: } } void onMediaData(RtmpPacket &chunkData) override { - m_parser->inputRtmp(chunkData); + if(m_parser){ + m_parser->inputRtmp(chunkData); + } } }; diff --git a/src/Rtsp/RtpParser.cpp b/src/Rtsp/RtpParser.cpp index 6e668562..67940bc0 100644 --- a/src/Rtsp/RtpParser.cpp +++ b/src/Rtsp/RtpParser.cpp @@ -182,6 +182,9 @@ inline void RtpParser::onGetAudioTrack(const RtspTrack& audio) { m_strAudioCfg.push_back(cfg2); makeAdtsHeader(m_strAudioCfg,m_adts); getAACInfo(m_adts, m_iSampleRate, m_iChannel); + if(m_adts.profile >= 3){ + throw std::runtime_error("不支持该profile的AAC"); + } } inline void RtpParser::onGetVideoTrack(const RtspTrack& video) { diff --git a/src/Rtsp/Rtsp.cpp b/src/Rtsp/Rtsp.cpp index 49da3b79..c4d67a35 100644 --- a/src/Rtsp/Rtsp.cpp +++ b/src/Rtsp/Rtsp.cpp @@ -31,9 +31,15 @@ string FindField(const char* buf, const char* start, const char *end ,int bufSiz return string(msg_start, msg_end); } int parserSDP(const string& sdp, RtspTrack Track[2]) { - string track_str = "track"; + string track_str; if (sdp.find("trackID=") != string::npos) { track_str = "trackID="; + }else if (sdp.find("track") != string::npos) { + track_str = "track"; + }else if (sdp.find("streamid=") != string::npos) { + track_str = "streamid="; + }else if (sdp.find("stream") != string::npos) { + track_str = "stream"; } int track_cnt = 0; string::size_type pos_head = sdp.find("m=");