推流器主动断开时,避免开启断流续推功能

This commit is contained in:
xiongziliang 2022-07-02 15:36:32 +08:00
parent 7a24a22661
commit 121b78e5dd
2 changed files with 4 additions and 2 deletions

View File

@ -219,10 +219,11 @@ void RtmpSession::onCmd_publish(AMFDecoder &dec) {
}
void RtmpSession::onCmd_deleteStream(AMFDecoder &dec) {
_push_src = nullptr;
//此时回复可能触发broken pipe事件从而直接触发onError回调所以需要先把_push_src置空防止触发断流续推功能
sendStatus({ "level", "status",
"code", "NetStream.Unpublish.Success",
"description", "Stop publishing." });
_push_src = nullptr;
throw std::runtime_error(StrPrinter << "Stop publishing" << endl);
}

View File

@ -867,8 +867,9 @@ void RtspSession::handleReq_Pause(const Parser &parser) {
}
void RtspSession::handleReq_Teardown(const Parser &parser) {
sendRtspResponse("200 OK");
_push_src = nullptr;
//此时回复可能触发broken pipe事件从而直接触发onError回调所以需要先把_push_src置空防止触发断流续推功能
sendRtspResponse("200 OK");
throw SockException(Err_shutdown,"recv teardown request");
}