From dea44dcd78418ed3e7f191a73cee2b81a7a0019f Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期五, 13 一月 2023 16:21:17 +0800
Subject: [PATCH] Merge branch 'wvp-28181-2.0'
---
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java | 64 +++++++++++++++++++++++---------
1 files changed, 46 insertions(+), 18 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 e31995c..c9b979f 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
@@ -1,6 +1,7 @@
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl;
import com.alibaba.fastjson2.JSONObject;
+import com.genersoft.iot.vmp.common.VideoManagerConstants;
import com.genersoft.iot.vmp.conf.DynamicTask;
import com.genersoft.iot.vmp.conf.SipConfig;
import com.genersoft.iot.vmp.conf.UserSetting;
@@ -439,18 +440,23 @@
try {
// 瓒呮椂鏈敹鍒癆ck搴旇鍥炲bye,褰撳墠绛夊緟鏃堕棿涓�10绉�
- dynamicTask.startDelay(callIdHeader.getCallId(), () -> {
- logger.info("Ack 绛夊緟瓒呮椂");
- mediaServerService.releaseSsrc(mediaServerItemInUSe.getId(), sendRtpItem.getSsrc());
- // 鍥炲bye
- try {
- cmderFroPlatform.streamByeCmd(platform, callIdHeader.getCallId());
- } catch (SipException | InvalidArgumentException | ParseException e) {
- logger.error("[鍛戒护鍙戦�佸け璐 鍥芥爣绾ц仈 鍙戦�丅YE: {}", e.getMessage());
- }
- }, 60 * 1000);
- responseSdpAck(request, content.toString(), platform);
+ if (userSetting.getPushStreamAfterAck()) {
+ dynamicTask.startDelay(callIdHeader.getCallId(), () -> {
+ logger.info("Ack 绛夊緟瓒呮椂");
+ mediaServerService.releaseSsrc(mediaServerItemInUSe.getId(), sendRtpItem.getSsrc());
+ // 鍥炲bye
+ try {
+ cmderFroPlatform.streamByeCmd(platform, callIdHeader.getCallId());
+ } catch (SipException | InvalidArgumentException | ParseException e) {
+ logger.error("[鍛戒护鍙戦�佸け璐 鍥芥爣绾ц仈 鍙戦�丅YE: {}", e.getMessage());
+ }
+ }, 60 * 1000);
+ }
+ SIPResponse sipResponse = responseSdpAck(request, content.toString(), platform);
+ if (!userSetting.getPushStreamAfterAck()) {
+ playService.startPushStream(sendRtpItem, sipResponse, platform, request.getCallIdHeader());
+ }
} catch (SipException e) {
e.printStackTrace();
} catch (InvalidArgumentException e) {
@@ -878,7 +884,11 @@
content.append("f=\r\n");
try {
- return responseSdpAck(request, content.toString(), platform);
+ SIPResponse sipResponse = responseSdpAck(request, content.toString(), platform);
+ if (!userSetting.getPushStreamAfterAck()) {
+ playService.startPushStream(sendRtpItem, sipResponse, platform, request.getCallIdHeader());
+ }
+ return sipResponse;
} catch (SipException e) {
e.printStackTrace();
} catch (InvalidArgumentException e) {
@@ -905,11 +915,14 @@
}
if (device != null) {
logger.info("鏀跺埌璁惧" + requesterId + "鐨勮闊冲箍鎾璉nvite璇锋眰");
-
+ String key = VideoManagerConstants.BROADCAST_WAITE_INVITE + device.getDeviceId() + audioBroadcastCatch.getChannelId();
+ dynamicTask.stop(key);
try {
responseAck(request, Response.TRYING);
} catch (SipException | InvalidArgumentException | ParseException e) {
logger.error("[鍛戒护鍙戦�佸け璐 invite BAD_REQUEST: {}", e.getMessage());
+ playService.stopAudioBroadcast(device.getDeviceId(), audioBroadcastCatch.getChannelId());
+ return;
}
String contentString = new String(request.getRawContent());
// jainSip涓嶆敮鎸亂=瀛楁锛� 绉婚櫎绉婚櫎浠ヨВ鏋愩��
@@ -964,11 +977,14 @@
responseAck(request, Response.UNSUPPORTED_MEDIA_TYPE); // 涓嶆敮鎸佺殑鏍煎紡锛屽彂415
} catch (SipException | InvalidArgumentException | ParseException e) {
logger.error("[鍛戒护鍙戦�佸け璐 invite 涓嶆敮鎸佺殑濯掍綋鏍煎紡: {}", e.getMessage());
+ playService.stopAudioBroadcast(device.getDeviceId(), audioBroadcastCatch.getChannelId());
+ return;
}
return;
}
String addressStr = sdp.getOrigin().getAddress();
- logger.info("璁惧{}璇锋眰璇煶娴侊紝鍦板潃锛歿}:{}锛宻src锛歿}", requesterId, addressStr, port, ssrc);
+ logger.info("璁惧{}璇锋眰璇煶娴侊紝鍦板潃锛歿}:{}锛宻src锛歿}, {}", requesterId, addressStr, port, ssrc,
+ mediaTransmissionTCP ? (tcpActive? "TCP涓诲姩":"TCP琚姩") : "UDP");
MediaServerItem mediaServerItem = playService.getNewMediaServerItem(device);
if (mediaServerItem == null) {
@@ -977,6 +993,7 @@
responseAck(request, Response.BUSY_HERE);
} catch (SipException | InvalidArgumentException | ParseException e) {
logger.error("[鍛戒护鍙戦�佸け璐 invite 鏈壘鍒板彲鐢ㄧ殑zlm: {}", e.getMessage());
+ playService.stopAudioBroadcast(device.getDeviceId(), audioBroadcastCatch.getChannelId());
}
return;
}
@@ -990,13 +1007,12 @@
responseAck(request, Response.BUSY_HERE);
} catch (SipException | InvalidArgumentException | ParseException e) {
logger.error("[鍛戒护鍙戦�佸け璐 invite 鏈嶅姟鍣ㄧ鍙h祫婧愪笉瓒�: {}", e.getMessage());
+ playService.stopAudioBroadcast(device.getDeviceId(), audioBroadcastCatch.getChannelId());
+ return;
}
return;
}
- sendRtpItem.setTcp(mediaTransmissionTCP);
- if (tcpActive != null) {
- sendRtpItem.setTcpActive(tcpActive);
- }
+
String app = "broadcast";
String stream = device.getDeviceId() + "_" + audioBroadcastCatch.getChannelId();
@@ -1011,6 +1027,11 @@
sendRtpItem.setUsePs(false);
sendRtpItem.setRtcp(false);
sendRtpItem.setOnlyAudio(true);
+ sendRtpItem.setTcp(mediaTransmissionTCP);
+ if (tcpActive != null) {
+ sendRtpItem.setTcpActive(tcpActive);
+ }
+
redisCatchStorage.updateSendRTPSever(sendRtpItem);
Boolean streamReady = zlmrtpServerFactory.isStreamReady(mediaServerItem, app, stream);
@@ -1022,11 +1043,13 @@
responseAck(request, Response.GONE);
} catch (SipException | InvalidArgumentException | ParseException e) {
logger.error("[鍛戒护鍙戦�佸け璐 璇煶閫氳瘽 鍥炲410澶辫触锛� {}", e.getMessage());
+ return;
}
playService.stopAudioBroadcast(device.getDeviceId(), audioBroadcastCatch.getChannelId());
}
} catch (SdpException e) {
logger.error("[SDP瑙f瀽寮傚父]", e);
+ playService.stopAudioBroadcast(device.getDeviceId(), audioBroadcastCatch.getChannelId());
}
} else {
logger.warn("鏉ヨ嚜鏃犳晥璁惧/骞冲彴鐨勮姹�");
@@ -1083,6 +1106,11 @@
audioBroadcastCatch.setSipTransactionInfoByRequset(sipResponse);
audioBroadcastManager.update(audioBroadcastCatch);
+ // 寮�鍚彂娴侊紝澶у崕鍦ㄦ敹鍒�200OK鍚庡氨浼氬紑濮嬪缓绔嬭繛鎺�
+ if (!userSetting.getPushStreamAfterAck()) {
+ playService.startPushStream(sendRtpItem, sipResponse, parentPlatform, request.getCallIdHeader());
+ }
+
} catch (SipException | InvalidArgumentException | ParseException | SdpParseException e) {
logger.error("[鍛戒护鍙戦�佸け璐 璇煶瀵硅 鍥炲200OK锛圫DP锛�: {}", e.getMessage());
}
--
Gitblit v1.8.0