fix(rtsp): 修复RTSP传输模式字符串格式问题(#4797)

This commit is contained in:
xiongziliang
2026-08-26 17:59:44 +08:00
parent 034eae91ad
commit 70bd146aa6
2 changed files with 5 additions and 6 deletions

View File

@@ -285,18 +285,17 @@ void RtspPlayer::sendSetup(unsigned int track_idx) {
case Rtsp::RTP_TCP: {
sendRtspRequest(
"SETUP", control_url,
{ "Transport", StrPrinter << "RTP/AVP/TCP;unicast;interleaved=" << track_idx * 2 << "-" << track_idx * 2 + 1 << ";mode=play" });
{ "Transport", StrPrinter << "RTP/AVP/TCP;unicast;interleaved=" << track_idx * 2 << "-" << track_idx * 2 + 1 << ";mode=\"PLAY\"" });
} break;
case Rtsp::RTP_MULTICAST: {
sendRtspRequest("SETUP", control_url, { "Transport", "RTP/AVP;multicast;mode=play" });
sendRtspRequest("SETUP", control_url, { "Transport", "RTP/AVP;multicast;mode=\"PLAY\"" });
} break;
case Rtsp::RTP_UDP: {
createUdpSockIfNecessary(track_idx);
sendRtspRequest(
"SETUP", control_url,
{ "Transport",
StrPrinter << "RTP/AVP;unicast;client_port=" << _rtp_sock[track_idx]->get_local_port() << "-" << _rtcp_sock[track_idx]->get_local_port()
<< ";mode=play" });
StrPrinter << "RTP/AVP;unicast;client_port=" << _rtp_sock[track_idx]->get_local_port() << "-" << _rtcp_sock[track_idx]->get_local_port() << ";mode=\"PLAY\"" });
} break;
default: break;
}

View File

@@ -278,14 +278,14 @@ void RtspPusher::sendSetup(unsigned int track_idx) {
case Rtsp::RTP_TCP: {
sendRtspRequest("SETUP", control_url, {"Transport",
StrPrinter << "RTP/AVP/TCP;unicast;interleaved=" << track_idx * 2
<< "-" << track_idx * 2 + 1 << ";mode=record"});
<< "-" << track_idx * 2 + 1 << ";mode=\"RECORD\""});
}
break;
case Rtsp::RTP_UDP: {
createUdpSockIfNecessary(track_idx);
int port = _rtp_sock[track_idx]->get_local_port();
sendRtspRequest("SETUP", control_url,
{"Transport", StrPrinter << "RTP/AVP;unicast;client_port=" << port << "-" << port + 1 << ";mode=record"});
{"Transport", StrPrinter << "RTP/AVP;unicast;client_port=" << port << "-" << port + 1 << ";mode=\"RECORD\""});
}
break;
default: