From c04de4cd70d1698741547998b1b6d67f46c64735 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期四, 17 十一月 2022 10:04:05 +0800
Subject: [PATCH] 注释与日志优化
---
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
index 598c087..f221880 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
@@ -45,6 +45,7 @@
import javax.sip.message.Response;
import java.text.ParseException;
import java.time.Instant;
+import java.util.Random;
import java.util.Vector;
/**
@@ -157,11 +158,6 @@
StreamProxyItem proxyByAppAndStream =null;
// 涓嶆槸閫氶亾鍙兘鏄洿鎾祦
if (channel != null && gbStream == null) {
-// if (channel.getStatus() == 0) {
-// logger.info("閫氶亾绂荤嚎锛岃繑鍥�400");
-// responseAck(request, Response.BAD_REQUEST, "channel [" + channel.getChannelId() + "] offline");
-// return;
-// }
// 閫氶亾瀛樺湪锛屽彂100锛孴RYING
try {
responseAck(request, Response.TRYING);
@@ -385,7 +381,12 @@
} else {
content.append("t=0 0\r\n");
}
- content.append("m=video " + sendRtpItem.getLocalPort() + " RTP/AVP 96\r\n");
+ int localPort = sendRtpItem.getLocalPort();
+ if (localPort == 0) {
+ // 闈炰弗鏍兼ā寮忕鍙d笉缁熶竴, 澧炲姞鍏煎鎬э紝淇敼涓轰竴涓笉涓�0鐨勭鍙�
+ localPort = new Random().nextInt(65535) + 1;
+ }
+ content.append("m=video " + localPort + " RTP/AVP 96\r\n");
content.append("a=sendonly\r\n");
content.append("a=rtpmap:96 PS/90000\r\n");
content.append("y=" + sendRtpItem.getSsrc() + "\r\n");
@@ -476,9 +477,11 @@
// 鍐欏叆redis锛� 瓒呮椂鏃跺洖澶�
redisCatchStorage.updateSendRTPSever(sendRtpItem);
+ MediaServerItem finalMediaServerItem = mediaServerItem;
playService.play(mediaServerItem, ssrcInfo, device, channelId, hookEvent, errorEvent, (code, msg) -> {
logger.info("[涓婄骇鐐规挱]瓒呮椂, 鐢ㄦ埛锛歿}锛� 閫氶亾锛歿}", username, channelId);
redisCatchStorage.deleteSendRTPServer(platform.getServerGBId(), channelId, callIdHeader.getCallId(), null);
+ zlmrtpServerFactory.releasePort(finalMediaServerItem, sendRtpItem.getSsrc());
}, null);
} else {
sendRtpItem.setStreamId(playTransaction.getStream());
--
Gitblit v1.8.0