diff --git a/src/Rtmp/RtmpSession.cpp b/src/Rtmp/RtmpSession.cpp index 88333fd8..566fcad1 100644 --- a/src/Rtmp/RtmpSession.cpp +++ b/src/Rtmp/RtmpSession.cpp @@ -28,7 +28,7 @@ RtmpSession::~RtmpSession() { } void RtmpSession::onError(const SockException& err) { - bool is_player = !_push_src; + bool is_player = !_push_src_ownership; uint64_t duration = _ticker.createdTime() / 1000; WarnP(this) << (is_player ? "RTMP播放器(" : "RTMP推流器(") << _media_info._vhost << "/" @@ -50,7 +50,7 @@ void RtmpSession::onError(const SockException& err) { _push_src_ownership = nullptr; //延时10秒注销流 auto push_src = std::move(_push_src); - _delay_unregister_task = getPoller()->doDelayTask(_continue_push_ms, [push_src]() { return 0; }); + getPoller()->doDelayTask(_continue_push_ms, [push_src]() { return 0; }); } } @@ -222,11 +222,7 @@ void RtmpSession::onCmd_deleteStream(AMFDecoder &dec) { sendStatus({ "level", "status", "code", "NetStream.Unpublish.Success", "description", "Stop publishing." }); - //_push_src = nullptr; - //TraceL<<" delete stream"; - if(_delay_unregister_task){ - _delay_unregister_task->cancel(); - } + _push_src = nullptr; throw std::runtime_error(StrPrinter << "Stop publishing" << endl); } diff --git a/src/Rtmp/RtmpSession.h b/src/Rtmp/RtmpSession.h index 5289a43f..c6367d35 100644 --- a/src/Rtmp/RtmpSession.h +++ b/src/Rtmp/RtmpSession.h @@ -103,8 +103,6 @@ private: std::weak_ptr _play_src; AMFValue _push_metadata; RtmpMediaSourceImp::Ptr _push_src; - //延迟注销任务 - toolkit::EventPoller::DelayTask::Ptr _delay_unregister_task; std::shared_ptr _push_src_ownership; RtmpMediaSource::RingType::RingReader::Ptr _ring_reader; }; diff --git a/src/Rtsp/RtspSession.cpp b/src/Rtsp/RtspSession.cpp index ce66a3f2..f7093d63 100644 --- a/src/Rtsp/RtspSession.cpp +++ b/src/Rtsp/RtspSession.cpp @@ -60,7 +60,7 @@ RtspSession::~RtspSession() { } void RtspSession::onError(const SockException &err) { - bool is_player = !_push_src; + bool is_player = !_push_src_ownership; uint64_t duration = _alive_ticker.createdTime() / 1000; WarnP(this) << (is_player ? "RTSP播放器(" : "RTSP推流器(") << _media_info._vhost << "/" @@ -868,7 +868,7 @@ void RtspSession::handleReq_Pause(const Parser &parser) { void RtspSession::handleReq_Teardown(const Parser &parser) { sendRtspResponse("200 OK"); - //_push_src = nullptr; + _push_src = nullptr; throw SockException(Err_shutdown,"recv teardown request"); }