From e46f1ae9150028b794a9519dda7d66bf77a486c2 Mon Sep 17 00:00:00 2001
From: xu-bin-bin <34916924+xu-bin-bin@users.noreply.github.com>
Date: 星期四, 31 八月 2023 16:51:06 +0800
Subject: [PATCH] Merge branch '648540858:wvp-28181-2.0' into wvp-28181-2.0
---
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java | 72 ++++++------------------------------
1 files changed, 12 insertions(+), 60 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
old mode 100644
new mode 100755
index 260b9a4..f2653f7
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
@@ -12,7 +12,6 @@
import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
-import com.genersoft.iot.vmp.gb28181.session.SSRCFactory;
import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
@@ -39,7 +38,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
@@ -160,10 +158,7 @@
}
}
}
- String streamId = null;
- if (mediaServerItem.isRtpEnable()) {
- streamId = String.format("%s_%s", device.getDeviceId(), channelId);
- }
+ String streamId = String.format("%s_%s", device.getDeviceId(), channelId);;
SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId, ssrc, device.isSsrcCheck(), false, 0, false, device.getStreamModeForParam());
if (ssrcInfo == null) {
callback.run(InviteErrorCode.ERROR_FOR_RESOURCE_EXHAUSTION.getCode(), InviteErrorCode.ERROR_FOR_RESOURCE_EXHAUSTION.getMsg(), null);
@@ -459,16 +454,13 @@
logger.warn("[褰曞儚鍥炴斁] 鍗曠鍙f敹娴佹椂涓嶆敮鎸乀CP涓诲姩鏂瑰紡鏀舵祦 deviceId: {},channelId:{}", deviceId, channelId);
throw new ControllerException(ErrorCode.ERROR100.getCode(), "鍗曠鍙f敹娴佹椂涓嶆敮鎸乀CP涓诲姩鏂瑰紡鏀舵祦");
}
- String stream = null;
- if (newMediaServerItem.isRtpEnable()) {
- String startTimeStr = startTime.replace("-", "")
- .replace(":", "")
- .replace(" ", "");
- String endTimeTimeStr = endTime.replace("-", "")
- .replace(":", "")
- .replace(" ", "");
- stream = deviceId + "_" + channelId + "_" + startTimeStr + "_" + endTimeTimeStr;
- }
+ String startTimeStr = startTime.replace("-", "")
+ .replace(":", "")
+ .replace(" ", "");
+ String endTimeTimeStr = endTime.replace("-", "")
+ .replace(":", "")
+ .replace(" ", "");
+ String stream = deviceId + "_" + channelId + "_" + startTimeStr + "_" + endTimeTimeStr;
SSRCInfo ssrcInfo = mediaServerService.openRTPServer(newMediaServerItem, stream, null, device.isSsrcCheck(), true, 0, false, device.getStreamModeForParam());
playBack(newMediaServerItem, ssrcInfo, deviceId, channelId, startTime, endTime, callback);
}
@@ -630,44 +622,13 @@
if (ssrcInResponse != null) {
// 鍗曠鍙�
// 閲嶆柊璁㈤槄娴佷笂绾�
- HookSubscribeForStreamChange hookSubscribe = HookSubscribeFactory.on_stream_changed("rtp",
- ssrcInfo.getStream(), true, "rtsp", mediaServerItem.getId());
- subscribe.removeSubscribe(hookSubscribe);
SsrcTransaction ssrcTransaction = streamSession.getSsrcTransaction(inviteInfo.getDeviceId(),
inviteInfo.getChannelId(), null, inviteInfo.getStream());
streamSession.remove(inviteInfo.getDeviceId(),
inviteInfo.getChannelId(), inviteInfo.getStream());
-
- String stream = String.format("%08x", Integer.parseInt(ssrcInResponse)).toUpperCase();
- hookSubscribe.getContent().put("stream", stream);
-
- inviteStreamService.updateInviteInfoForStream(inviteInfo, stream);
+ inviteStreamService.updateInviteInfoForSSRC(inviteInfo, ssrcInResponse);
streamSession.put(device.getDeviceId(), channelId, ssrcTransaction.getCallId(),
- stream, ssrcInResponse, mediaServerItem.getId(), (SIPResponse) responseEvent.getResponse(), inviteSessionType);
- subscribe.addSubscribe(hookSubscribe, (mediaServerItemInUse, hookParam) -> {
- logger.info("[Invite 200OK] ssrc淇鍚庢敹鍒拌闃呮秷鎭細 " + hookParam);
- dynamicTask.stop(timeOutTaskKey);
- subscribe.removeSubscribe(hookSubscribe);
- // hook鍝嶅簲
- StreamInfo streamInfo = onPublishHandlerForPlay(mediaServerItemInUse, hookParam, device.getDeviceId(), channelId);
- if (streamInfo == null){
- callback.run(InviteErrorCode.ERROR_FOR_STREAM_PARSING_EXCEPTIONS.getCode(),
- InviteErrorCode.ERROR_FOR_STREAM_PARSING_EXCEPTIONS.getMsg(), null);
- inviteStreamService.call(inviteSessionType, device.getDeviceId(), channelId, null,
- InviteErrorCode.ERROR_FOR_STREAM_PARSING_EXCEPTIONS.getCode(),
- InviteErrorCode.ERROR_FOR_STREAM_PARSING_EXCEPTIONS.getMsg(), null);
- return;
- }
- callback.run(InviteErrorCode.SUCCESS.getCode(),
- InviteErrorCode.SUCCESS.getMsg(), streamInfo);
- inviteStreamService.call(inviteSessionType, device.getDeviceId(), channelId, null,
- InviteErrorCode.SUCCESS.getCode(),
- InviteErrorCode.SUCCESS.getMsg(),
- streamInfo);
- if (inviteSessionType == InviteSessionType.PLAY) {
- snapOnPlay(mediaServerItemInUse, device.getDeviceId(), channelId, stream);
- }
- });
+ inviteInfo.getStream(), ssrcInResponse, mediaServerItem.getId(), (SIPResponse) responseEvent.getResponse(), inviteSessionType);
}
}
}
@@ -688,17 +649,8 @@
null);
return;
}
- String stream = null;
- if (newMediaServerItem.isRtpEnable()) {
- String startTimeStr = startTime.replace("-", "")
- .replace(":", "")
- .replace(" ", "");
- String endTimeTimeStr = endTime.replace("-", "")
- .replace(":", "")
- .replace(" ", "");
- stream = deviceId + "_" + channelId + "_" + startTimeStr + "_" + endTimeTimeStr;
- }
- SSRCInfo ssrcInfo = mediaServerService.openRTPServer(newMediaServerItem, stream, null, device.isSsrcCheck(), true, 0, false, device.getStreamModeForParam());
+ // 褰曞儚涓嬭浇涓嶄娇鐢ㄥ浐瀹氭祦鍦板潃锛屽浐瀹氭祦鍦板潃浼氬鑷村鏋滃紑濮嬫椂闂翠笌缁撴潫鏃堕棿涓�鑷存椂鏂囦欢閿欒鐨勫彔鍔犲湪涓�璧�
+ SSRCInfo ssrcInfo = mediaServerService.openRTPServer(newMediaServerItem, null, null, device.isSsrcCheck(), true, 0, false, device.getStreamModeForParam());
download(newMediaServerItem, ssrcInfo, deviceId, channelId, startTime, endTime, downloadSpeed, callback);
}
--
Gitblit v1.8.0