mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-23 03:10:04 +08:00
修复兼容性bug
This commit is contained in:
parent
07d6546a96
commit
f6074bfd25
@ -211,6 +211,11 @@ inline void RtpParser::onGetVideoTrack(const RtspTrack& video) {
|
|||||||
throw std::runtime_error("只支持264格式的视频!");
|
throw std::runtime_error("只支持264格式的视频!");
|
||||||
}
|
}
|
||||||
string sps_pps = FindField(video.trackSdp.c_str(), "sprop-parameter-sets=", "\r\n");
|
string sps_pps = FindField(video.trackSdp.c_str(), "sprop-parameter-sets=", "\r\n");
|
||||||
|
if(sps_pps.empty()){
|
||||||
|
//SDP里面没SPS_PPS描述,需要在后续rtp中获取
|
||||||
|
m_bParseSpsDelay = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
string base64_SPS = FindField(sps_pps.c_str(), NULL, ",");
|
string base64_SPS = FindField(sps_pps.c_str(), NULL, ",");
|
||||||
string base64_PPS = FindField(sps_pps.c_str(), ",", NULL);
|
string base64_PPS = FindField(sps_pps.c_str(), ",", NULL);
|
||||||
if(base64_PPS.back() == ';'){
|
if(base64_PPS.back() == ';'){
|
||||||
@ -270,8 +275,14 @@ inline void RtpParser::_onGetH264(H264Frame& frame) {
|
|||||||
case 1: //P
|
case 1: //P
|
||||||
onGetH264(frame);
|
onGetH264(frame);
|
||||||
break;
|
break;
|
||||||
case 7://SPS
|
case 7: {//SPS
|
||||||
m_strSPS=frame.data;break;
|
m_strSPS = frame.data;
|
||||||
|
if(m_bParseSpsDelay && !m_strSPS.empty()){
|
||||||
|
m_bParseSpsDelay = false;
|
||||||
|
getAVCInfo(m_strSPS, m_iVideoWidth, m_iVideoHeight, m_fVideoFps);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 8://PPS
|
case 8://PPS
|
||||||
m_strPPS=frame.data;break;
|
m_strPPS=frame.data;break;
|
||||||
default:
|
default:
|
||||||
|
@ -139,6 +139,7 @@ private:
|
|||||||
bool m_bHaveAudio = false;
|
bool m_bHaveAudio = false;
|
||||||
bool m_bHaveVideo= false;
|
bool m_bHaveVideo= false;
|
||||||
float m_fDuration = 0;
|
float m_fDuration = 0;
|
||||||
|
bool m_bParseSpsDelay = false;
|
||||||
|
|
||||||
function<void(const H264Frame &frame)> onVideo;
|
function<void(const H264Frame &frame)> onVideo;
|
||||||
function<void(const AdtsFrame &frame)> onAudio;
|
function<void(const AdtsFrame &frame)> onAudio;
|
||||||
|
Loading…
Reference in New Issue
Block a user