防止析构函数抛异常导致崩溃问题 (#2546)

This commit is contained in:
夏楚
2023-06-11 22:07:15 +08:00
committed by GitHub
parent fe37005526
commit 5ca4ed53b2
9 changed files with 33 additions and 14 deletions

View File

@@ -16,9 +16,11 @@ SrtTransportImp::~SrtTransportImp() {
// 流量统计事件广播
GET_CONFIG(uint32_t, iFlowThreshold, General::kFlowThreshold);
if (_total_bytes >= iFlowThreshold * 1024) {
NoticeCenter::Instance().emitEvent(
Broadcast::kBroadcastFlowReport, _media_info, _total_bytes, duration, !_is_pusher,
static_cast<SockInfo &>(*this));
try {
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastFlowReport, _media_info, _total_bytes, duration, !_is_pusher, static_cast<SockInfo &>(*this));
} catch (std::exception &ex) {
WarnL << "Exception occurred: " << ex.what();
}
}
}