From 2441951dc5e6760286daf3ac723819e84c3e23ed Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Fri, 15 Dec 2023 16:37:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B0=83=E7=94=A8close=5Fstr?= =?UTF-8?q?eams=E5=90=8E=E6=B5=81=E6=B3=A8=E9=94=80=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E4=B8=89=E7=A7=92=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Rtp/RtpSession.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Rtp/RtpSession.cpp b/src/Rtp/RtpSession.cpp index 85f0c2fb..40db50f3 100644 --- a/src/Rtp/RtpSession.cpp +++ b/src/Rtp/RtpSession.cpp @@ -46,11 +46,7 @@ RtpSession::RtpSession(const Socket::Ptr &sock) } } -RtpSession::~RtpSession() { - if (_process) { - RtpSelector::Instance().delProcess(_stream_id, _process.get()); - } -} +RtpSession::~RtpSession() = default; void RtpSession::onRecv(const Buffer::Ptr &data) { if (_is_udp) { @@ -62,6 +58,9 @@ void RtpSession::onRecv(const Buffer::Ptr &data) { void RtpSession::onError(const SockException &err) { WarnP(this) << _stream_id << " " << err; + if (_process) { + RtpSelector::Instance().delProcess(_stream_id, _process.get()); + } } void RtpSession::onManager() {