添加兼容性适配代码

This commit is contained in:
xiongziliang 2017-09-21 16:51:44 +08:00
parent f68dddfa9c
commit 46d1d80954
3 changed files with 13 additions and 2 deletions

View File

@ -51,7 +51,9 @@ private:
} }
} }
void onMediaData(RtmpPacket &chunkData) override { void onMediaData(RtmpPacket &chunkData) override {
m_parser->inputRtmp(chunkData); if(m_parser){
m_parser->inputRtmp(chunkData);
}
} }
}; };

View File

@ -182,6 +182,9 @@ inline void RtpParser::onGetAudioTrack(const RtspTrack& audio) {
m_strAudioCfg.push_back(cfg2); m_strAudioCfg.push_back(cfg2);
makeAdtsHeader(m_strAudioCfg,m_adts); makeAdtsHeader(m_strAudioCfg,m_adts);
getAACInfo(m_adts, m_iSampleRate, m_iChannel); 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) { inline void RtpParser::onGetVideoTrack(const RtspTrack& video) {

View File

@ -31,9 +31,15 @@ string FindField(const char* buf, const char* start, const char *end ,int bufSiz
return string(msg_start, msg_end); return string(msg_start, msg_end);
} }
int parserSDP(const string& sdp, RtspTrack Track[2]) { int parserSDP(const string& sdp, RtspTrack Track[2]) {
string track_str = "track"; string track_str;
if (sdp.find("trackID=") != string::npos) { if (sdp.find("trackID=") != string::npos) {
track_str = "trackID="; 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; int track_cnt = 0;
string::size_type pos_head = sdp.find("m="); string::size_type pos_head = sdp.find("m=");