From c5f1b4cd529c2ba129078855b3032d1f7cae0f7c Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sat, 24 Oct 2020 23:29:44 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E9=80=80=E5=87=BA=E6=97=B6?= =?UTF-8?q?=E6=B8=85=E7=A9=BARtpProcess=E5=AF=B9=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/WebApi.cpp | 3 +++ src/Rtp/RtpSelector.cpp | 5 +++++ src/Rtp/RtpSelector.h | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/server/WebApi.cpp b/server/WebApi.cpp index 8eb54174..839df9db 100644 --- a/server/WebApi.cpp +++ b/server/WebApi.cpp @@ -1155,6 +1155,8 @@ void installWebApi() { } void unInstallWebApi(){ + RtpSelector::Instance().clear(); + { lock_guard lck(s_proxyMapMtx); s_proxyMap.clear(); @@ -1164,6 +1166,7 @@ void unInstallWebApi(){ lock_guard lck(s_ffmpegMapMtx); s_ffmpegMap.clear(); } + { #if defined(ENABLE_RTPPROXY) lock_guard lck(s_rtpServerMapMtx); diff --git a/src/Rtp/RtpSelector.cpp b/src/Rtp/RtpSelector.cpp index 0ab553f2..b895de25 100644 --- a/src/Rtp/RtpSelector.cpp +++ b/src/Rtp/RtpSelector.cpp @@ -15,6 +15,11 @@ namespace mediakit{ INSTANCE_IMP(RtpSelector); +void RtpSelector::clear(){ + lock_guard lck(_mtx_map); + _map_rtp_process.clear(); +} + bool RtpSelector::inputRtp(const Socket::Ptr &sock, const char *data, int data_len, const struct sockaddr *addr,uint32_t *dts_out) { //使用ssrc为流id diff --git a/src/Rtp/RtpSelector.h b/src/Rtp/RtpSelector.h index 33a01256..54be19ca 100644 --- a/src/Rtp/RtpSelector.h +++ b/src/Rtp/RtpSelector.h @@ -55,6 +55,11 @@ public: static bool getSSRC(const char *data,int data_len, uint32_t &ssrc); static RtpSelector &Instance(); + /** + * 清空所有对象 + */ + void clear(); + /** * 输入多个rtp流,根据ssrc分流 * @param sock 本地socket