From 3b4818c5799e7ce5b0ffb44d7bbc712427b03f37 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Fri, 13 Dec 2024 17:41:02 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=81=9C=E6=AD=A2=E5=BD=95?= =?UTF-8?q?=E5=83=8F=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gb28181/controller/GBRecordController.java | 18 +++++++----------- .../gb28181/controller/PlaybackController.java | 4 +--- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/GBRecordController.java b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/GBRecordController.java index 81159b3e..c56389b2 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/GBRecordController.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/GBRecordController.java @@ -1,9 +1,9 @@ package com.genersoft.iot.vmp.gb28181.controller; +import com.genersoft.iot.vmp.common.InviteSessionType; import com.genersoft.iot.vmp.common.StreamInfo; import com.genersoft.iot.vmp.conf.UserSetting; import com.genersoft.iot.vmp.conf.exception.ControllerException; -import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException; import com.genersoft.iot.vmp.conf.security.JwtUtils; import com.genersoft.iot.vmp.gb28181.bean.Device; import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; @@ -32,9 +32,6 @@ import org.springframework.web.bind.annotation.RestController; import org.springframework.web.context.request.async.DeferredResult; import javax.servlet.http.HttpServletRequest; -import javax.sip.InvalidArgumentException; -import javax.sip.SipException; -import java.text.ParseException; import java.util.UUID; import java.util.concurrent.TimeUnit; @@ -170,7 +167,7 @@ public class GBRecordController { @Parameter(name = "channelId", description = "通道国标编号", required = true) @Parameter(name = "stream", description = "流ID", required = true) @GetMapping("/download/stop/{deviceId}/{channelId}/{stream}") - public void playStop(@PathVariable String deviceId, @PathVariable String channelId, @PathVariable String stream) { + public void downloadStop(@PathVariable String deviceId, @PathVariable String channelId, @PathVariable String stream) { if (log.isDebugEnabled()) { log.debug(String.format("设备历史媒体下载停止 API调用,deviceId/channelId:%s_%s", deviceId, channelId)); @@ -182,14 +179,13 @@ public class GBRecordController { Device device = deviceService.getDeviceByDeviceId(deviceId); if (device == null) { - throw new ControllerException(ErrorCode.ERROR400.getCode(), "设备:" + deviceId + "未找到"); + throw new ControllerException(ErrorCode.ERROR400.getCode(), "设备:" + deviceId + " 未找到"); } - - try { - cmder.streamByeCmd(device, channelId, stream, null); - } catch (InvalidArgumentException | ParseException | SipException | SsrcTransactionNotFoundException e) { - log.warn("[停止历史媒体下载]停止历史媒体下载,发送BYE失败 {}", e.getMessage()); + DeviceChannel deviceChannel = channelService.getOneForSource(deviceId, channelId); + if (deviceChannel == null) { + throw new ControllerException(ErrorCode.ERROR400.getCode(), "通道:" + channelId + " 未找到"); } + playService.stop(InviteSessionType.DOWNLOAD, device, deviceChannel, stream); } @Operation(summary = "获取历史媒体下载进度", security = @SecurityRequirement(name = JwtUtils.HEADER)) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/PlaybackController.java b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/PlaybackController.java index dbc0b1a7..87108508 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/PlaybackController.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/PlaybackController.java @@ -41,8 +41,6 @@ import java.net.URL; import java.text.ParseException; import java.util.UUID; -import static sun.audio.AudioDevice.device; - /** * @author lin */ @@ -158,7 +156,7 @@ public class PlaybackController { } DeviceChannel deviceChannel = channelService.getOneForSource(deviceId, channelId); if (deviceChannel == null) { - throw new ControllerException(ErrorCode.ERROR400.getCode(), "通道:" + deviceChannel + " 未找到"); + throw new ControllerException(ErrorCode.ERROR400.getCode(), "通道:" + channelId + " 未找到"); } playService.stop(InviteSessionType.PLAYBACK, device, deviceChannel, stream); }