From 2c1dbe63de3d370d0b0f20fea474326e88b9ca23 Mon Sep 17 00:00:00 2001 From: lawrencehj <1934378145@qq.com> Date: 星期三, 10 三月 2021 14:39:40 +0800 Subject: [PATCH] 增加接收Bye请求后停止向上级推流功能 --- src/main/java/com/genersoft/iot/vmp/web/ApiStreamController.java | 23 +++++++++++++---------- 1 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/web/ApiStreamController.java b/src/main/java/com/genersoft/iot/vmp/web/ApiStreamController.java index 5964e99..5a56bef 100644 --- a/src/main/java/com/genersoft/iot/vmp/web/ApiStreamController.java +++ b/src/main/java/com/genersoft/iot/vmp/web/ApiStreamController.java @@ -1,20 +1,18 @@ package com.genersoft.iot.vmp.web; import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.genersoft.iot.vmp.common.StreamInfo; import com.genersoft.iot.vmp.gb28181.bean.Device; import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; -import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; +// import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; +import com.genersoft.iot.vmp.storager.IRedisCatchStorage; import com.genersoft.iot.vmp.storager.IVideoManagerStorager; import com.genersoft.iot.vmp.vmanager.play.PlayController; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import org.springframework.web.context.request.async.DeferredResult; @@ -22,6 +20,7 @@ /** * 鍏煎LiveGBS鐨凙PI锛氬疄鏃剁洿鎾� */ +@SuppressWarnings(value = {"rawtypes", "unchecked"}) @CrossOrigin @RestController @RequestMapping(value = "/api/v1/stream") @@ -35,11 +34,12 @@ @Autowired private IVideoManagerStorager storager; - private boolean closeWaitRTPInfo = false; - - @Autowired - private ZLMRESTfulUtils zlmresTfulUtils; + private IRedisCatchStorage redisCatchStorage; + + + // @Autowired + // private ZLMRESTfulUtils zlmresTfulUtils; @Autowired @@ -86,6 +86,8 @@ JSONObject result = new JSONObject(); result.put("error","timeout"); resultDeferredResult.setResult(result); + + // 娓呯悊RTP server }); DeviceChannel deviceChannel = storager.queryChannel(serial, code); @@ -156,14 +158,15 @@ ){ - StreamInfo streamInfo = storager.queryPlayByDevice(serial, code); + StreamInfo streamInfo = redisCatchStorage.queryPlayByDevice(serial, code); if (streamInfo == null) { JSONObject result = new JSONObject(); result.put("error","鏈壘鍒版祦淇℃伅"); return result; } cmder.streamByeCmd(streamInfo.getStreamId()); - storager.stopPlay(streamInfo); + redisCatchStorage.stopPlay(streamInfo); + storager.stopPlay(streamInfo.getDeviceID(), streamInfo.getChannelId()); return null; } -- Gitblit v1.8.0