Commit bf70a01f by xiongziliang

提升rtsp的兼容性

parent 21cf3bce
...@@ -823,21 +823,15 @@ void RtspPlayer::onPlayResult_l(const SockException &ex , bool handshakeComplete ...@@ -823,21 +823,15 @@ void RtspPlayer::onPlayResult_l(const SockException &ex , bool handshakeComplete
} }
} }
int RtspPlayer::getTrackIndexByControlSuffix(const string &controlSuffix) const{
for (unsigned int i = 0; i < _aTrackInfo.size(); i++) {
auto pos = _aTrackInfo[i]->_control_surffix.find(controlSuffix);
if (pos == 0) {
return i;
}
}
return -1;
}
int RtspPlayer::getTrackIndexByInterleaved(int interleaved) const{ int RtspPlayer::getTrackIndexByInterleaved(int interleaved) const{
for (unsigned int i = 0; i < _aTrackInfo.size(); i++) { for (unsigned int i = 0; i < _aTrackInfo.size(); i++) {
if (_aTrackInfo[i]->_interleaved == interleaved) { if (_aTrackInfo[i]->_interleaved == interleaved) {
return i; return i;
} }
} }
if(_aTrackInfo.size() == 1){
return 0;
}
return -1; return -1;
} }
...@@ -847,6 +841,9 @@ int RtspPlayer::getTrackIndexByTrackType(TrackType trackType) const { ...@@ -847,6 +841,9 @@ int RtspPlayer::getTrackIndexByTrackType(TrackType trackType) const {
return i; return i;
} }
} }
if(_aTrackInfo.size() == 1){
return 0;
}
return -1; return -1;
} }
......
...@@ -103,7 +103,6 @@ private: ...@@ -103,7 +103,6 @@ private:
void onRecvRTP_l(const RtpPacket::Ptr &pRtppt, const SdpTrack::Ptr &track); void onRecvRTP_l(const RtpPacket::Ptr &pRtppt, const SdpTrack::Ptr &track);
void onPlayResult_l(const SockException &ex , bool handshakeCompleted); void onPlayResult_l(const SockException &ex , bool handshakeCompleted);
int getTrackIndexByControlSuffix(const string &controlSuffix) const;
int getTrackIndexByInterleaved(int interleaved) const; int getTrackIndexByInterleaved(int interleaved) const;
int getTrackIndexByTrackType(TrackType trackType) const; int getTrackIndexByTrackType(TrackType trackType) const;
......
...@@ -351,6 +351,9 @@ inline int RtspPusher::getTrackIndexByTrackType(TrackType type) { ...@@ -351,6 +351,9 @@ inline int RtspPusher::getTrackIndexByTrackType(TrackType type) {
return i; return i;
} }
} }
if(_aTrackInfo.size() == 1){
return 0;
}
return -1; return -1;
} }
......
...@@ -1105,6 +1105,9 @@ inline int RtspSession::getTrackIndexByTrackType(TrackType type) { ...@@ -1105,6 +1105,9 @@ inline int RtspSession::getTrackIndexByTrackType(TrackType type) {
return i; return i;
} }
} }
if(_aTrackInfo.size() == 1){
return 0;
}
return -1; return -1;
} }
inline int RtspSession::getTrackIndexByControlSuffix(const string &controlSuffix) { inline int RtspSession::getTrackIndexByControlSuffix(const string &controlSuffix) {
...@@ -1125,6 +1128,9 @@ inline int RtspSession::getTrackIndexByInterleaved(int interleaved){ ...@@ -1125,6 +1128,9 @@ inline int RtspSession::getTrackIndexByInterleaved(int interleaved){
return i; return i;
} }
} }
if(_aTrackInfo.size() == 1){
return 0;
}
return -1; return -1;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论