From c859fe228ccc7d9e83d89e3c2513ae3548d4425f Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期五, 30 九月 2022 09:25:15 +0800
Subject: [PATCH] 更新文档
---
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java | 61 +++++-------------------------
1 files changed, 11 insertions(+), 50 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 ff9a39a..bcd8bf1 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
@@ -216,65 +216,20 @@
@Parameter(name = "timeout", description = "鎺ㄦ祦瓒呮椂鏃堕棿(绉�)", required = true)
@GetMapping("/broadcast/{deviceId}/{channelId}")
@PostMapping("/broadcast/{deviceId}/{channelId}")
- public DeferredResult<String> broadcastApi(@PathVariable String deviceId, @PathVariable String channelId, Integer timeout) {
+ public AudioBroadcastResult broadcastApi(@PathVariable String deviceId, @PathVariable String channelId, Integer timeout) {
if (logger.isDebugEnabled()) {
logger.debug("璇煶骞挎挱API璋冪敤");
}
Device device = storager.queryVideoDevice(deviceId);
- DeferredResult<String> result = new DeferredResult<>(3 * 1000L);
if (device == null) {
- result.setResult("鏈壘鍒拌澶囷細 " + deviceId);
- return result;
+ throw new ControllerException(ErrorCode.ERROR400.getCode(), "鏈壘鍒拌澶囷細 " + deviceId);
}
if (channelId == null) {
- result.setResult("鏈壘鍒伴�氶亾锛� " + channelId);
- return result;
+ throw new ControllerException(ErrorCode.ERROR400.getCode(), "鏈壘鍒伴�氶亾锛� " + channelId);
}
- String key = DeferredResultHolder.CALLBACK_CMD_BROADCAST + deviceId;
- if (resultHolder.exist(key, null)) {
- result.setResult("璁惧浣跨敤涓�");
- return result;
- }
- if (timeout == null){
- timeout = 30;
- }
- String uuid = UUID.randomUUID().toString();
- result.onTimeout(() -> {
- logger.warn("璇煶骞挎挱鎿嶄綔瓒呮椂, 璁惧鏈繑鍥炲簲绛旀寚浠�");
- RequestMessage msg = new RequestMessage();
- msg.setKey(key);
- msg.setId(uuid);
- JSONObject json = new JSONObject();
- json.put("DeviceID", deviceId);
- json.put("CmdType", "Broadcast");
- json.put("Result", "Failed");
- json.put("Error", "Timeout. Device did not response to broadcast command.");
- msg.setData(json);
- resultHolder.invokeResult(msg);
- });
+ return playService.audioBroadcast(device, channelId);
- result.onTimeout(()->{
- WVPResult<AudioBroadcastResult> wvpResult = new WVPResult<>();
- wvpResult.setCode(-1);
- wvpResult.setMsg("璇锋眰瓒呮椂");
- RequestMessage requestMessage = new RequestMessage();
- requestMessage.setKey(key);
- requestMessage.setData(wvpResult);
- resultHolder.invokeAllResult(requestMessage);
- });
- playService.audioBroadcast(device, channelId, timeout, (msg)->{
- WVPResult<AudioBroadcastResult> wvpResult = new WVPResult<>();
- wvpResult.setCode(-1);
- wvpResult.setMsg(msg);
- RequestMessage requestMessage = new RequestMessage();
- requestMessage.setKey(key);
- requestMessage.setData(wvpResult);
- resultHolder.invokeAllResult(requestMessage);
- });
- resultHolder.put(key, uuid, result);
-
- return result;
}
@@ -283,10 +238,16 @@
@Parameter(name = "channelId", description = "閫氶亾Id", required = true)
@GetMapping("/broadcast/stop/{deviceId}/{channelId}")
@PostMapping("/broadcast/stop/{deviceId}/{channelId}")
- public void stopBroadcastA(@PathVariable String deviceId, @PathVariable String channelId) {
+ public void stopBroadcast(@PathVariable String deviceId, @PathVariable String channelId) {
if (logger.isDebugEnabled()) {
logger.debug("鍋滄璇煶骞挎挱API璋冪敤");
}
+// try {
+// playService.stopAudioBroadcast(deviceId, channelId);
+// } catch (InvalidArgumentException | ParseException | SsrcTransactionNotFoundException | SipException e) {
+// logger.error("[鍛戒护鍙戦�佸け璐 鍋滄璇煶: {}", e.getMessage());
+// throw new ControllerException(ErrorCode.ERROR100.getCode(), "鍛戒护鍙戦�佸け璐�: " + e.getMessage());
+// }
playService.stopAudioBroadcast(deviceId, channelId);
}
--
Gitblit v1.8.0