Commit 20a3cb9e73d16bd08d99780b91ca0e8d8722a0f9
1 parent
faac9361
启用失败的流转发如果开启无人观看自动移除则不保存在数据库
Showing
1 changed file
with
12 additions
and
11 deletions
src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java
| ... | ... | @@ -105,24 +105,23 @@ public class StreamProxyServiceImpl implements IStreamProxyService { |
| 105 | 105 | result.append("保存成功"); |
| 106 | 106 | if (param.isEnable()) { |
| 107 | 107 | JSONObject jsonObject = addStreamProxyToZlm(param); |
| 108 | - if (jsonObject == null) { | |
| 108 | + if (jsonObject == null || jsonObject.getInteger("code") != 0) { | |
| 109 | 109 | streamLive = false; |
| 110 | 110 | result.append(", 但是启用失败,请检查流地址是否可用"); |
| 111 | 111 | param.setEnable(false); |
| 112 | - videoManagerStorager.updateStreamProxy(param); | |
| 113 | - }else { | |
| 114 | - Integer code = jsonObject.getInteger("code"); | |
| 115 | - if (code == 0) { | |
| 116 | - streamLive = true; | |
| 117 | - StreamInfo streamInfo = mediaService.getStreamInfoByAppAndStream( | |
| 118 | - mediaInfo, param.getApp(), param.getStream(), null); | |
| 119 | - wvpResult.setData(streamInfo); | |
| 112 | + // 直接移除 | |
| 113 | + if (param.isEnable_remove_none_reader()) { | |
| 114 | + del(param.getApp(), param.getStream()); | |
| 120 | 115 | }else { |
| 121 | - result.append(", 但是启用失败,请检查流地址是否可用"); | |
| 122 | - param.setEnable(false); | |
| 123 | 116 | videoManagerStorager.updateStreamProxy(param); |
| 124 | 117 | } |
| 125 | 118 | |
| 119 | + }else { | |
| 120 | + streamLive = true; | |
| 121 | + StreamInfo streamInfo = mediaService.getStreamInfoByAppAndStream( | |
| 122 | + mediaInfo, param.getApp(), param.getStream(), null); | |
| 123 | + wvpResult.setData(streamInfo); | |
| 124 | + | |
| 126 | 125 | } |
| 127 | 126 | } |
| 128 | 127 | }else { |
| ... | ... | @@ -202,8 +201,10 @@ public class StreamProxyServiceImpl implements IStreamProxyService { |
| 202 | 201 | platformGbStreamMapper.delByAppAndStream(app, stream); |
| 203 | 202 | // TODO 如果关联的推流, 那么状态设置为离线 |
| 204 | 203 | } |
| 204 | + redisCatchStorage.removeStream(streamProxyItem.getMediaServerId(), "PULL", app, stream); | |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | + | |
| 207 | 208 | } |
| 208 | 209 | |
| 209 | 210 | @Override | ... | ... |