From 613399cc6d14cfe5b8a245d462629ecee5deb2db Mon Sep 17 00:00:00 2001
From: xiaoQQya <xiaoQQya@126.com>
Date: 星期二, 17 十月 2023 17:49:31 +0800
Subject: [PATCH] fix(play): 修复单端口推流下级自定义 ssrc 时, 流注册后接口仍然超时的问题
---
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/SIPRequestProcessorParent.java | 27 ++++++++++++++++++++++-----
1 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/SIPRequestProcessorParent.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/SIPRequestProcessorParent.java
old mode 100644
new mode 100755
index 55c98fe..d983d41
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/SIPRequestProcessorParent.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/SIPRequestProcessorParent.java
@@ -3,6 +3,7 @@
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.transmit.SIPSender;
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
+import com.google.common.primitives.Bytes;
import gov.nist.javax.sip.message.SIPRequest;
import gov.nist.javax.sip.message.SIPResponse;
import org.apache.commons.lang3.ArrayUtils;
@@ -45,7 +46,7 @@
try {
return SipFactory.getInstance().createHeaderFactory();
} catch (PeerUnavailableException e) {
- e.printStackTrace();
+ logger.error("鏈鐞嗙殑寮傚父 ", e);
}
return null;
}
@@ -54,7 +55,7 @@
try {
return SipFactory.getInstance().createMessageFactory();
} catch (PeerUnavailableException e) {
- e.printStackTrace();
+ logger.error("鏈鐞嗙殑寮傚父 ", e);
}
return null;
}
@@ -196,10 +197,26 @@
result.add(rawContent[i]);
}
}
- Byte[] bytes = new Byte[0];
- byte[] bytesResult = ArrayUtils.toPrimitive(result.toArray(bytes));
+ byte[] bytesResult = Bytes.toArray(result);
- Document xml = reader.read(new ByteArrayInputStream(bytesResult));
+ Document xml;
+ try {
+ xml = reader.read(new ByteArrayInputStream(bytesResult));
+ }catch (DocumentException e) {
+ logger.warn("[xml瑙f瀽寮傚父]锛� 鍘熸枃濡備笅锛� \r\n{}", new String(bytesResult));
+ logger.warn("[xml瑙f瀽寮傚父]锛� 鍘熸枃濡備笅锛� 灏濊瘯鍏煎鎬у鐞�");
+ String[] xmlLineArray = new String(bytesResult).split("\\r?\\n");
+
+ // 鍏煎娴峰悍鐨刟ddress瀛楁甯︽湁<鐮存崲xml缁撴瀯瀵艰嚧鏃犳硶瑙f瀽xml鐨勯棶棰�
+ StringBuilder stringBuilder = new StringBuilder();
+ for (String s : xmlLineArray) {
+ if (s.startsWith("<Address")) {
+ continue;
+ }
+ stringBuilder.append(s);
+ }
+ xml = reader.read(new ByteArrayInputStream(stringBuilder.toString().getBytes()));
+ }
return xml.getRootElement();
}
--
Gitblit v1.8.0