mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 04:31:37 +08:00
完善推流判断逻辑
This commit is contained in:
parent
87dd1c7f7f
commit
7a24a22661
@ -28,7 +28,7 @@ RtmpSession::~RtmpSession() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RtmpSession::onError(const SockException& err) {
|
void RtmpSession::onError(const SockException& err) {
|
||||||
bool is_player = !_push_src;
|
bool is_player = !_push_src_ownership;
|
||||||
uint64_t duration = _ticker.createdTime() / 1000;
|
uint64_t duration = _ticker.createdTime() / 1000;
|
||||||
WarnP(this) << (is_player ? "RTMP播放器(" : "RTMP推流器(")
|
WarnP(this) << (is_player ? "RTMP播放器(" : "RTMP推流器(")
|
||||||
<< _media_info._vhost << "/"
|
<< _media_info._vhost << "/"
|
||||||
@ -50,7 +50,7 @@ void RtmpSession::onError(const SockException& err) {
|
|||||||
_push_src_ownership = nullptr;
|
_push_src_ownership = nullptr;
|
||||||
//延时10秒注销流
|
//延时10秒注销流
|
||||||
auto push_src = std::move(_push_src);
|
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",
|
sendStatus({ "level", "status",
|
||||||
"code", "NetStream.Unpublish.Success",
|
"code", "NetStream.Unpublish.Success",
|
||||||
"description", "Stop publishing." });
|
"description", "Stop publishing." });
|
||||||
//_push_src = nullptr;
|
_push_src = nullptr;
|
||||||
//TraceL<<" delete stream";
|
|
||||||
if(_delay_unregister_task){
|
|
||||||
_delay_unregister_task->cancel();
|
|
||||||
}
|
|
||||||
throw std::runtime_error(StrPrinter << "Stop publishing" << endl);
|
throw std::runtime_error(StrPrinter << "Stop publishing" << endl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,8 +103,6 @@ private:
|
|||||||
std::weak_ptr<RtmpMediaSource> _play_src;
|
std::weak_ptr<RtmpMediaSource> _play_src;
|
||||||
AMFValue _push_metadata;
|
AMFValue _push_metadata;
|
||||||
RtmpMediaSourceImp::Ptr _push_src;
|
RtmpMediaSourceImp::Ptr _push_src;
|
||||||
//延迟注销任务
|
|
||||||
toolkit::EventPoller::DelayTask::Ptr _delay_unregister_task;
|
|
||||||
std::shared_ptr<void> _push_src_ownership;
|
std::shared_ptr<void> _push_src_ownership;
|
||||||
RtmpMediaSource::RingType::RingReader::Ptr _ring_reader;
|
RtmpMediaSource::RingType::RingReader::Ptr _ring_reader;
|
||||||
};
|
};
|
||||||
|
@ -60,7 +60,7 @@ RtspSession::~RtspSession() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RtspSession::onError(const SockException &err) {
|
void RtspSession::onError(const SockException &err) {
|
||||||
bool is_player = !_push_src;
|
bool is_player = !_push_src_ownership;
|
||||||
uint64_t duration = _alive_ticker.createdTime() / 1000;
|
uint64_t duration = _alive_ticker.createdTime() / 1000;
|
||||||
WarnP(this) << (is_player ? "RTSP播放器(" : "RTSP推流器(")
|
WarnP(this) << (is_player ? "RTSP播放器(" : "RTSP推流器(")
|
||||||
<< _media_info._vhost << "/"
|
<< _media_info._vhost << "/"
|
||||||
@ -868,7 +868,7 @@ void RtspSession::handleReq_Pause(const Parser &parser) {
|
|||||||
|
|
||||||
void RtspSession::handleReq_Teardown(const Parser &parser) {
|
void RtspSession::handleReq_Teardown(const Parser &parser) {
|
||||||
sendRtspResponse("200 OK");
|
sendRtspResponse("200 OK");
|
||||||
//_push_src = nullptr;
|
_push_src = nullptr;
|
||||||
throw SockException(Err_shutdown,"recv teardown request");
|
throw SockException(Err_shutdown,"recv teardown request");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user