支持日志上下文

This commit is contained in:
xiongziliang
2023-11-20 21:59:43 +08:00
parent a13b8417e5
commit 8bd7157ca1
14 changed files with 32 additions and 20 deletions

View File

@@ -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() {

View File

@@ -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 {