mirror of
https://gitee.com/xia-chu/ZLMediaKit.git
synced 2026-05-06 10:57:50 +08:00
修复rtsp点播相关问题 (#4445)
Some checks failed
Android / build (push) Has been cancelled
CodeQL / Analyze (cpp) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Docker / build (push) Has been cancelled
Linux / build (push) Has been cancelled
macOS / build (push) Has been cancelled
Windows / build (push) Has been cancelled
Some checks failed
Android / build (push) Has been cancelled
CodeQL / Analyze (cpp) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Docker / build (push) Has been cancelled
Linux / build (push) Has been cancelled
macOS / build (push) Has been cancelled
Windows / build (push) Has been cancelled
This commit is contained in:
parent
c19f348786
commit
3028612a0e
@ -411,12 +411,11 @@ void RtspPlayer::handleResSETUP(const Parser &parser, unsigned int track_idx) {
|
|||||||
// All SETUP commands have been sent
|
// All SETUP commands have been sent
|
||||||
// 发送play命令 [AUTO-TRANSLATED:47a826d1]
|
// 发送play命令 [AUTO-TRANSLATED:47a826d1]
|
||||||
// Send PLAY command
|
// Send PLAY command
|
||||||
if (_speed==0.0f) {
|
if (_speed == 0.0f) {
|
||||||
sendPause(type_play, 0);
|
sendPause(type_play, 0);
|
||||||
} else {
|
} else {
|
||||||
sendPause(type_speed, 0);
|
sendPause(type_speed, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RtspPlayer::sendDescribe() {
|
void RtspPlayer::sendDescribe() {
|
||||||
@ -465,15 +464,11 @@ void RtspPlayer::sendPause(int type, uint32_t seekMS) {
|
|||||||
// Start or pause RTSP
|
// Start or pause RTSP
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case type_pause: sendRtspRequest("PAUSE", _control_url, {}); break;
|
case type_pause: sendRtspRequest("PAUSE", _control_url, {}); break;
|
||||||
case type_play:
|
case type_play: sendRtspRequest("PLAY", _content_base); break;
|
||||||
// sendRtspRequest("PLAY", _content_base);
|
|
||||||
// break;
|
|
||||||
case type_seek:
|
case type_seek:
|
||||||
sendRtspRequest("PLAY", _control_url, { "Range", StrPrinter << "npt=" << setiosflags(ios::fixed) << setprecision(2) << seekMS / 1000.0 << "-" });
|
sendRtspRequest("PLAY", _control_url, { "Range", StrPrinter << "npt=" << setiosflags(ios::fixed) << setprecision(2) << seekMS / 1000.0 << "-" });
|
||||||
break;
|
break;
|
||||||
case type_speed:
|
case type_speed: speed(_speed); break;
|
||||||
speed(_speed);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
WarnL << "unknown type : " << type;
|
WarnL << "unknown type : " << type;
|
||||||
_on_response = nullptr;
|
_on_response = nullptr;
|
||||||
@ -632,11 +627,6 @@ void RtspPlayer::sendRtspRequest(const string &cmd, const string &url, const std
|
|||||||
key = val;
|
key = val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cmd == "PLAY") {
|
|
||||||
for (auto &pr : _custom_header) {
|
|
||||||
header_map.emplace(pr.first, pr.second);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sendRtspRequest(cmd, url, header_map);
|
sendRtspRequest(cmd, url, header_map);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -698,6 +688,11 @@ void RtspPlayer::sendRtspRequest(const string &cmd, const string &url, const Str
|
|||||||
for (auto &pr : header) {
|
for (auto &pr : header) {
|
||||||
printer << pr.first << ": " << pr.second << "\r\n";
|
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";
|
printer << "\r\n";
|
||||||
SockSender::send(std::move(printer));
|
SockSender::send(std::move(printer));
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user