From a915897c530460f3c4463c34e242e6407fcdcb4c Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期三, 07 八月 2024 09:38:48 +0800
Subject: [PATCH] 兼容arm zlm 无法获取到Params的问题

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

diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
index 73f20bf..a1d302a 100755
--- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
+++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
@@ -47,7 +47,10 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.sip.InvalidArgumentException;
 import javax.sip.SipException;
+import java.net.MalformedURLException;
+import java.net.URL;
 import java.text.ParseException;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
@@ -376,17 +379,38 @@
                     }
                     redisCatchStorage.updateStreamAuthorityInfo(param.getApp(), param.getStream(), streamAuthorityInfo);
 
-                    Map<String, String> params = MediaServerUtils.urlParamToMap(param.getParams());
-                    param.setParamMap(params);
-                    StreamInfo streamInfoByAppAndStream = mediaService.getStreamInfoByAppAndStream(mediaInfo,
-                            param.getApp(), param.getStream(), tracks, params.get("callId"));
-                    param.setStreamInfo(new StreamContent(streamInfoByAppAndStream));
+                    if (!"broadcast".equals(param.getApp()) && !"talk".equals(param.getApp())) {
+                        String paramsStr = param.getParams();
+                        if (paramsStr == null) {
+                            // 鍏煎arm zlm 鏃犳硶鑾峰彇鍒癙arams鐨勯棶棰�
+                            URL url = null;
+                            try {
+                                url = new URL("http" + param.getOriginUrl().substring(4));
+                            } catch (MalformedURLException ignored) {}
+                            if (url != null) {
+                                paramsStr = url.getQuery();
+                            }
+                        }
+                        if (paramsStr != null) {
+                            Map<String, String> params = MediaServerUtils.urlParamToMap(paramsStr);
+                            param.setParamMap(params);
+                        }else {
+                            param.setParamMap(new HashMap<>());
+                            logger.warn("鑾峰彇鎺ㄦ祦鐨刾arams淇℃伅澶辫触");
+                        }
 
-                    param.setSeverId(userSetting.getServerId());
-                    streamPushService.updatePush(param);
-                    // 鍐椾綑鏁版嵁锛岃嚜宸辩郴缁熶腑鑷敤
-                    redisCatchStorage.addPushListItem(param.getApp(), param.getStream(), param);
+                        StreamInfo streamInfoByAppAndStream = mediaService.getStreamInfoByAppAndStream(mediaInfo,
+                                param.getApp(), param.getStream(), tracks, param.getParamMap().get("callId"));
+                        param.setStreamInfo(new StreamContent(streamInfoByAppAndStream));
+
+                        param.setSeverId(userSetting.getServerId());
+                        streamPushService.updatePush(param);
+                        // 鍐椾綑鏁版嵁锛岃嚜宸辩郴缁熶腑鑷敤
+                        redisCatchStorage.addPushListItem(param.getApp(), param.getStream(), param);
+                    }
                 }
+            }else {
+                redisCatchStorage.removePushListItem(param.getApp(), param.getStream(), param.getMediaServerId());
             }
             // TODO 淇敼涓虹涓�涓负鍑� 鍚庣画涓嶅啀澶勭悊
             if ("rtsp".equals(param.getSchema())) {

--
Gitblit v1.8.0