Commit 09a23bc80e017e73160c3fba89f609fe045f5748
1 parent
809e4c98
修复布防撤防 #717
Showing
3 changed files
with
5 additions
and
9 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
| ... | ... | @@ -726,8 +726,6 @@ public class SIPCommander implements ISIPCommander { |
| 726 | 726 | cmdXml.append("<GuardCmd>" + guardCmdStr + "</GuardCmd>\r\n"); |
| 727 | 727 | cmdXml.append("</Control>\r\n"); |
| 728 | 728 | |
| 729 | - | |
| 730 | - | |
| 731 | 729 | Request request = headerProvider.createMessageRequest(device, cmdXml.toString(), null, SipUtils.getNewFromTag(), null,sipSender.getNewCallIdHeader(sipLayer.getLocalIp(device.getLocalIp()),device.getTransport())); |
| 732 | 730 | sipSender.transmitRequest(sipLayer.getLocalIp(device.getLocalIp()), request, errorEvent); |
| 733 | 731 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
| ... | ... | @@ -244,6 +244,9 @@ public class PlayServiceImpl implements IPlayService { |
| 244 | 244 | mediaServerService.closeRTPServer(mediaServerItem, ssrcInfo.getStream()); |
| 245 | 245 | streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream()); |
| 246 | 246 | mediaServerService.closeRTPServer(mediaServerItem, ssrcInfo.getStream()); |
| 247 | + // 取消订阅消息监听 | |
| 248 | + HookSubscribeForStreamChange hookSubscribe = HookSubscribeFactory.on_stream_changed("rtp", ssrcInfo.getStream(), true, "rtsp", mediaServerItem.getId()); | |
| 249 | + subscribe.removeSubscribe(hookSubscribe); | |
| 247 | 250 | } |
| 248 | 251 | } |
| 249 | 252 | }, userSetting.getPlayTimeout()); |
| ... | ... | @@ -253,7 +256,6 @@ public class PlayServiceImpl implements IPlayService { |
| 253 | 256 | dynamicTask.stop(timeOutTaskKey); |
| 254 | 257 | // 释放ssrc |
| 255 | 258 | mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc()); |
| 256 | - | |
| 257 | 259 | streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream()); |
| 258 | 260 | |
| 259 | 261 | RequestMessage msg = new RequestMessage(); | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceControl.java
| ... | ... | @@ -14,7 +14,6 @@ import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| 14 | 14 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; |
| 15 | 15 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; |
| 16 | 16 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 17 | - | |
| 18 | 17 | import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; |
| 19 | 18 | import io.swagger.v3.oas.annotations.Operation; |
| 20 | 19 | import io.swagger.v3.oas.annotations.Parameter; |
| ... | ... | @@ -22,10 +21,8 @@ import io.swagger.v3.oas.annotations.tags.Tag; |
| 22 | 21 | import org.slf4j.Logger; |
| 23 | 22 | import org.slf4j.LoggerFactory; |
| 24 | 23 | import org.springframework.beans.factory.annotation.Autowired; |
| 25 | -import org.springframework.http.HttpStatus; | |
| 26 | 24 | import org.springframework.http.ResponseEntity; |
| 27 | 25 | import org.springframework.util.ObjectUtils; |
| 28 | -import org.springframework.util.StringUtils; | |
| 29 | 26 | import org.springframework.web.bind.annotation.*; |
| 30 | 27 | import org.springframework.web.context.request.async.DeferredResult; |
| 31 | 28 | |
| ... | ... | @@ -130,15 +127,14 @@ public class DeviceControl { |
| 130 | 127 | */ |
| 131 | 128 | @Operation(summary = "布防/撤防命令") |
| 132 | 129 | @Parameter(name = "deviceId", description = "设备国标编号", required = true) |
| 133 | - @Parameter(name = "channelId", description = "通道国标编号", required = true) | |
| 134 | 130 | @Parameter(name = "guardCmdStr", description = "命令, 可选值:SetGuard(布防),ResetGuard(撤防)", required = true) |
| 135 | 131 | @GetMapping("/guard/{deviceId}/{guardCmdStr}") |
| 136 | - public DeferredResult<String> guardApi(@PathVariable String deviceId, String channelId, @PathVariable String guardCmdStr) { | |
| 132 | + public DeferredResult<String> guardApi(@PathVariable String deviceId, @PathVariable String guardCmdStr) { | |
| 137 | 133 | if (logger.isDebugEnabled()) { |
| 138 | 134 | logger.debug("布防/撤防API调用"); |
| 139 | 135 | } |
| 140 | 136 | Device device = storager.queryVideoDevice(deviceId); |
| 141 | - String key = DeferredResultHolder.CALLBACK_CMD_DEVICECONTROL + deviceId + channelId; | |
| 137 | + String key = DeferredResultHolder.CALLBACK_CMD_DEVICECONTROL + deviceId + deviceId; | |
| 142 | 138 | String uuid =UUID.randomUUID().toString(); |
| 143 | 139 | try { |
| 144 | 140 | cmder.guardCmd(device, guardCmdStr, event -> { | ... | ... |