From fe98e57fc4350ddc2220b5f6f2201d0d73573c01 Mon Sep 17 00:00:00 2001
From: panlinlin <648540858@qq.com>
Date: 星期一, 19 四月 2021 11:13:39 +0800
Subject: [PATCH] 增加对https的支持
---
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java | 38 +++++++++++++++-----------------------
1 files changed, 15 insertions(+), 23 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
index 1af7e6e..3d4c64c 100644
--- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
+++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
@@ -73,30 +73,21 @@
public DeferredResult<ResponseEntity<String>> play(@PathVariable String deviceId,
@PathVariable String channelId) {
-
PlayResult playResult = playService.play(deviceId, channelId, null, null);
- // 瓒呮椂澶勭悊
- playResult.getResult().onTimeout(()->{
- logger.warn(String.format("璁惧鐐规挱瓒呮椂锛宒eviceId锛�%s 锛宑hannelId锛�%s", deviceId, channelId));
- // 閲婃斁rtpserver
- cmder.closeRTPServer(playResult.getDevice(), channelId);
- RequestMessage msg = new RequestMessage();
- msg.setId(DeferredResultHolder.CALLBACK_CMD_PlAY + playResult.getUuid());
- msg.setData("Timeout");
- resultHolder.invokeResult(msg);
- });
+
return playResult.getResult();
}
@ApiOperation("鍋滄鐐规挱")
@ApiImplicitParams({
- @ApiImplicitParam(name = "streamId", value = "瑙嗛娴両D", dataTypeClass = String.class),
+ @ApiImplicitParam(name = "deviceId", value = "璁惧ID", dataTypeClass = String.class),
+ @ApiImplicitParam(name = "channelId", value = "閫氶亾ID", dataTypeClass = String.class),
})
- @PostMapping("/stop/{streamId}")
- public DeferredResult<ResponseEntity<String>> playStop(@PathVariable String streamId) {
+ @GetMapping("/stop/{deviceId}/{channelId}")
+ public DeferredResult<ResponseEntity<String>> playStop(@PathVariable String deviceId, @PathVariable String channelId) {
- logger.debug(String.format("璁惧棰勮/鍥炴斁鍋滄API璋冪敤锛宻treamId锛�%s", streamId));
+ logger.debug(String.format("璁惧棰勮/鍥炴斁鍋滄API璋冪敤锛宻treamId锛�%s/$s", deviceId, channelId ));
UUID uuid = UUID.randomUUID();
DeferredResult<ResponseEntity<String>> result = new DeferredResult<ResponseEntity<String>>();
@@ -104,12 +95,12 @@
// 褰曞儚鏌ヨ浠hannelId浣滀负deviceId鏌ヨ
resultHolder.put(DeferredResultHolder.CALLBACK_CMD_STOP + uuid, result);
- cmder.streamByeCmd(streamId, event -> {
- StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(streamId);
+ cmder.streamByeCmd(deviceId, channelId, event -> {
+ StreamInfo streamInfo = redisCatchStorage.queryPlayByDevice(deviceId, channelId);
if (streamInfo == null) {
RequestMessage msg = new RequestMessage();
- msg.setId(DeferredResultHolder.CALLBACK_CMD_PlAY + uuid);
- msg.setData("streamId not found");
+ msg.setId(DeferredResultHolder.CALLBACK_CMD_STOP + uuid);
+ msg.setData("鐐规挱鏈壘鍒�");
resultHolder.invokeResult(msg);
}else {
redisCatchStorage.stopPlay(streamInfo);
@@ -122,9 +113,10 @@
}
});
- if (streamId != null) {
+ if (deviceId != null || channelId != null) {
JSONObject json = new JSONObject();
- json.put("streamId", streamId);
+ json.put("deviceId", deviceId);
+ json.put("channelId", channelId);
RequestMessage msg = new RequestMessage();
msg.setId(DeferredResultHolder.CALLBACK_CMD_PlAY + uuid);
msg.setData(json.toString());
@@ -139,7 +131,7 @@
// 瓒呮椂澶勭悊
result.onTimeout(()->{
- logger.warn(String.format("璁惧棰勮/鍥炴斁鍋滄瓒呮椂锛宻treamId锛�%s ", streamId));
+ logger.warn(String.format("璁惧棰勮/鍥炴斁鍋滄瓒呮椂锛宒eviceId/channelId锛�%s/$s ", deviceId, channelId));
RequestMessage msg = new RequestMessage();
msg.setId(DeferredResultHolder.CALLBACK_CMD_STOP + uuid);
msg.setData("Timeout");
@@ -181,7 +173,7 @@
JSONObject data = jsonObject.getJSONObject("data");
if (data != null) {
result.put("key", data.getString("key"));
- StreamInfo streamInfoResult = mediaService.getStreamInfoByAppAndStream("convert", streamId);
+ StreamInfo streamInfoResult = mediaService.getStreamInfoByAppAndStreamWithCheck("convert", streamId);
result.put("data", streamInfoResult);
}
}else {
--
Gitblit v1.8.0