修复rtsp点播相关问题 (#4445)

This commit is contained in:
老衲不出家
2025-09-11 16:52:54 +08:00
committed by GitHub
parent c19f348786
commit 3028612a0e

View File

@@ -411,12 +411,11 @@ void RtspPlayer::handleResSETUP(const Parser &parser, unsigned int track_idx) {
// All SETUP commands have been sent
// 发送play命令 [AUTO-TRANSLATED:47a826d1]
// Send PLAY command
if (_speed==0.0f) {
if (_speed == 0.0f) {
sendPause(type_play, 0);
} else {
sendPause(type_speed, 0);
}
}
void RtspPlayer::sendDescribe() {
@@ -465,15 +464,11 @@ void RtspPlayer::sendPause(int type, uint32_t seekMS) {
// Start or pause RTSP
switch (type) {
case type_pause: sendRtspRequest("PAUSE", _control_url, {}); break;
case type_play:
// sendRtspRequest("PLAY", _content_base);
// break;
case type_play: sendRtspRequest("PLAY", _content_base); break;
case type_seek:
sendRtspRequest("PLAY", _control_url, { "Range", StrPrinter << "npt=" << setiosflags(ios::fixed) << setprecision(2) << seekMS / 1000.0 << "-" });
break;
case type_speed:
speed(_speed);
break;
case type_speed: speed(_speed); break;
default:
WarnL << "unknown type : " << type;
_on_response = nullptr;
@@ -632,11 +627,6 @@ void RtspPlayer::sendRtspRequest(const string &cmd, const string &url, const std
key = val;
}
}
if (cmd == "PLAY") {
for (auto &pr : _custom_header) {
header_map.emplace(pr.first, pr.second);
}
}
sendRtspRequest(cmd, url, header_map);
}
@@ -698,6 +688,11 @@ void RtspPlayer::sendRtspRequest(const string &cmd, const string &url, const Str
for (auto &pr : header) {
printer << pr.first << ": " << pr.second << "\r\n";
}
if (cmd == "PLAY") {
for (auto &pr : _custom_header) {
printer << pr.first << ": " << pr.second << "\r\n";
}
}
printer << "\r\n";
SockSender::send(std::move(printer));
}