From fb90dfdac54dfc9550604ef699e6390d433368b6 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期六, 01 七月 2023 10:14:19 +0800
Subject: [PATCH] 临时提交

---
 src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java
index a2093a8..666083a 100644
--- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java
+++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java
@@ -174,9 +174,10 @@
             Map<String, Object> param = new HashMap<>();
             param.put("stream_id", streamId);
             JSONObject jsonObject = zlmresTfulUtils.closeRtpServer(serverItem, param);
+            logger.info("鍏抽棴RTP Server " +  jsonObject);
             if (jsonObject != null ) {
                 if (jsonObject.getInteger("code") == 0) {
-                    result = jsonObject.getInteger("hit") == 1;
+                    result = jsonObject.getInteger("hit") >= 1;
                 }else {
                     logger.error("鍏抽棴RTP Server 澶辫触: " + jsonObject.getString("msg"));
                 }
@@ -301,6 +302,7 @@
         param.put("port", localPort);
         param.put("enable_tcp", 1);
         param.put("stream_id", ssrc);
+        param.put("re_use_port", 1);
         JSONObject jsonObject = zlmresTfulUtils.openRtpServer(serverItem, param);
         if (jsonObject.getInteger("code") == 0) {
             localPort = jsonObject.getInteger("port");
@@ -335,6 +337,11 @@
     public boolean releasePort(MediaServerItem serverItem, String ssrc) {
         logger.info("[淇濇寔绔彛] {}->閲婃斁鐩戝惉绔彛", ssrc);
         boolean closeRTPServerResult = closeRtpServer(serverItem, ssrc);
+        try {
+            Thread.sleep(1000);
+        } catch (InterruptedException e) {
+            throw new RuntimeException(e);
+        }
         HookSubscribeForRtpServerTimeout hookSubscribeForRtpServerTimeout = HookSubscribeFactory.on_rtp_server_timeout(ssrc, null, serverItem.getId());
         // 璁㈤槄 zlm鍚姩浜嬩欢, 鏂扮殑zlm涔熶細浠庤繖閲岃繘鍏ョ郴缁�
         hookSubscribe.removeSubscribe(hookSubscribeForRtpServerTimeout);

--
Gitblit v1.8.0