mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 10:40:05 +08:00
修复rtsp tcp 推送到 rtsp-simple-server 失败的问题, (#1274)
* for push rtsp to rtsp-simple-server remeber annoce response sessionid and setup tcp add mode=record * fix push rtsp to rtsp-simple-server over udp error add mode=record * 优化代码 Co-authored-by: 夏楚 <771730766@qq.com>
This commit is contained in:
parent
7aaa10eb3c
commit
50c6c2513d
@ -45,7 +45,6 @@ void RtspPusher::teardown() {
|
|||||||
_track_vec.clear();
|
_track_vec.clear();
|
||||||
_session_id.clear();
|
_session_id.clear();
|
||||||
_content_base.clear();
|
_content_base.clear();
|
||||||
_session_id.clear();
|
|
||||||
_cseq = 1;
|
_cseq = 1;
|
||||||
_publish_timer.reset();
|
_publish_timer.reset();
|
||||||
_beat_timer.reset();
|
_beat_timer.reset();
|
||||||
@ -207,6 +206,8 @@ void RtspPusher::handleResAnnounce(const Parser &parser) {
|
|||||||
if (_content_base.back() == '/') {
|
if (_content_base.back() == '/') {
|
||||||
_content_base.pop_back();
|
_content_base.pop_back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_session_id = parser["Session"];
|
||||||
|
|
||||||
sendSetup(0);
|
sendSetup(0);
|
||||||
}
|
}
|
||||||
@ -263,14 +264,14 @@ void RtspPusher::sendSetup(unsigned int track_idx) {
|
|||||||
case Rtsp::RTP_TCP: {
|
case Rtsp::RTP_TCP: {
|
||||||
sendRtspRequest("SETUP", control_url, {"Transport",
|
sendRtspRequest("SETUP", control_url, {"Transport",
|
||||||
StrPrinter << "RTP/AVP/TCP;unicast;interleaved=" << track->_type * 2
|
StrPrinter << "RTP/AVP/TCP;unicast;interleaved=" << track->_type * 2
|
||||||
<< "-" << track->_type * 2 + 1});
|
<< "-" << track->_type * 2 + 1 << ";mode=record"});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Rtsp::RTP_UDP: {
|
case Rtsp::RTP_UDP: {
|
||||||
createUdpSockIfNecessary(track_idx);
|
createUdpSockIfNecessary(track_idx);
|
||||||
int port = _rtp_sock[track_idx]->get_local_port();
|
int port = _rtp_sock[track_idx]->get_local_port();
|
||||||
sendRtspRequest("SETUP", control_url,
|
sendRtspRequest("SETUP", control_url,
|
||||||
{"Transport", StrPrinter << "RTP/AVP;unicast;client_port=" << port << "-" << port + 1});
|
{"Transport", StrPrinter << "RTP/AVP;unicast;client_port=" << port << "-" << port + 1 << ";mode=record"});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -566,4 +567,4 @@ void RtspPusher::sendRtspRequest(const string &cmd, const string &url,const StrC
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} /* namespace mediakit */
|
} /* namespace mediakit */
|
||||||
|
Loading…
Reference in New Issue
Block a user