From c9d755f4e88f83b77c43d00f857f0916ed75d087 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Fri, 14 Jan 2022 22:04:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BC=96=E8=AF=91=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 3rdpart/ZLToolKit | 2 +- server/WebApi.cpp | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/3rdpart/ZLToolKit b/3rdpart/ZLToolKit index dd101bcc..a71747c7 160000 --- a/3rdpart/ZLToolKit +++ b/3rdpart/ZLToolKit @@ -1 +1 @@ -Subproject commit dd101bcc31290e3d1ec1ae939d937f2712719a0d +Subproject commit a71747c7d0811263b12ef9112ec13fdffe2ab171 diff --git a/server/WebApi.cpp b/server/WebApi.cpp index c1dfec29..5db5bae8 100755 --- a/server/WebApi.cpp +++ b/server/WebApi.cpp @@ -1025,24 +1025,20 @@ void installWebApi() { api_regist("/index/api/openRtpServer",[](API_ARGS_MAP){ CHECK_SECRET(); CHECK_ARGS("port", "enable_tcp", "stream_id"); - bool enable_reuse=true; - if(!allArgs["enable_reuse"].empty()){ + bool enable_reuse = true; + if (!allArgs["enable_reuse"].empty()) { enable_reuse = allArgs["enable_reuse"].as(); } auto stream_id = allArgs["stream_id"]; lock_guard lck(s_rtpServerMapMtx); - if(s_rtpServerMap.find(stream_id) != s_rtpServerMap.end()) { + if (s_rtpServerMap.find(stream_id) != s_rtpServerMap.end()) { //为了防止RtpProcess所有权限混乱的问题,不允许重复添加相同的stream_id throw InvalidArgsException("该stream_id已存在"); } - - - - RtpServer::Ptr server = std::make_shared(); - server->start(allArgs["port"], stream_id, allArgs["enable_tcp"].as(),"0.0.0.0",enable_reuse); + server->start(allArgs["port"], stream_id, allArgs["enable_tcp"].as(), "0.0.0.0", enable_reuse); server->setOnDetach([stream_id]() { //设置rtp超时移除事件 lock_guard lck(s_rtpServerMapMtx);