mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-07-07 04:08:13 +08:00
支持日志上下文
This commit is contained in:
@@ -125,12 +125,10 @@ void SrtSession::onError(const SockException &err) {
|
||||
|
||||
// 防止互相引用导致不释放
|
||||
auto transport = std::move(_transport);
|
||||
getPoller()->async(
|
||||
[transport] {
|
||||
//延时减引用,防止使用transport对象时,销毁对象
|
||||
//transport->onShutdown(err);
|
||||
},
|
||||
false);
|
||||
async([transport] {
|
||||
// 延时减引用,防止使用transport对象时,销毁对象
|
||||
// transport->onShutdown(err);
|
||||
},false);
|
||||
}
|
||||
|
||||
void SrtSession::onManager() {
|
||||
|
||||
@@ -123,6 +123,7 @@ bool SrtTransportImp::close(mediakit::MediaSource &sender) {
|
||||
getPoller()->async([weak_self, err]() {
|
||||
auto strong_self = weak_self.lock();
|
||||
if (strong_self) {
|
||||
Logger::setThreadContext(weak_self);
|
||||
strong_self->onShutdown(SockException(Err_shutdown, err));
|
||||
// 主动关闭推流,那么不延时注销
|
||||
strong_self->_muxer = nullptr;
|
||||
@@ -158,6 +159,7 @@ void SrtTransportImp::emitOnPublish() {
|
||||
if (!strong_self) {
|
||||
return;
|
||||
}
|
||||
Logger::setThreadContext(weak_self);
|
||||
if (err.empty()) {
|
||||
strong_self->_muxer = std::make_shared<MultiMediaSourceMuxer>(strong_self->_media_info,0.0f,
|
||||
option);
|
||||
@@ -187,6 +189,7 @@ void SrtTransportImp::emitOnPlay() {
|
||||
return;
|
||||
}
|
||||
strong_self->getPoller()->async([strong_self, err] {
|
||||
Logger::setThreadContext(strong_self);
|
||||
if (err != "") {
|
||||
strong_self->onShutdown(SockException(Err_refused, err));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user