mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
优化webrtc性能
This commit is contained in:
parent
0aec2ee1c0
commit
3d64f7253c
@ -67,9 +67,7 @@ void WebRtcSession::onRecv_l(const Buffer::Ptr &buffer) {
|
||||
}
|
||||
_ticker.resetTime();
|
||||
CHECK(_transport);
|
||||
//先增加引用技术,防止使用transport时,触发onError事件导致对象释放
|
||||
auto transport = _transport;
|
||||
transport->inputSockData(buffer->data(), buffer->size(), &_peer_addr);
|
||||
_transport->inputSockData(buffer->data(), buffer->size(), &_peer_addr);
|
||||
}
|
||||
|
||||
void WebRtcSession::onError(const SockException &err) {
|
||||
@ -77,8 +75,11 @@ void WebRtcSession::onError(const SockException &err) {
|
||||
//在udp链接迁移时,新的WebRtcSession对象将接管WebRtcTransport对象的生命周期
|
||||
//本WebRtcSession对象将在超时后自动销毁
|
||||
WarnP(this) << err.what();
|
||||
//取消循环引用
|
||||
_transport = nullptr;
|
||||
|
||||
auto transport = std::move(_transport);
|
||||
this->Session::getPoller()->async([transport] {
|
||||
//延时减引用,防止使用transport对象时,销毁对象
|
||||
}, false);
|
||||
}
|
||||
|
||||
void WebRtcSession::onManager() {
|
||||
|
Loading…
Reference in New Issue
Block a user