Browse Source

启用失败的流转发如果开启无人观看自动移除则不保存在数据库

pull/276/head
648540858 3 years ago
parent
commit
20a3cb9e73
  1. 23
      src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java

23
src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java

@ -105,24 +105,23 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
result.append("保存成功"); result.append("保存成功");
if (param.isEnable()) { if (param.isEnable()) {
JSONObject jsonObject = addStreamProxyToZlm(param); JSONObject jsonObject = addStreamProxyToZlm(param);
if (jsonObject == null) { if (jsonObject == null || jsonObject.getInteger("code") != 0) {
streamLive = false; streamLive = false;
result.append(", 但是启用失败,请检查流地址是否可用"); result.append(", 但是启用失败,请检查流地址是否可用");
param.setEnable(false); param.setEnable(false);
videoManagerStorager.updateStreamProxy(param); // 直接移除
}else { if (param.isEnable_remove_none_reader()) {
Integer code = jsonObject.getInteger("code"); del(param.getApp(), param.getStream());
if (code == 0) {
streamLive = true;
StreamInfo streamInfo = mediaService.getStreamInfoByAppAndStream(
mediaInfo, param.getApp(), param.getStream(), null);
wvpResult.setData(streamInfo);
}else { }else {
result.append(", 但是启用失败,请检查流地址是否可用");
param.setEnable(false);
videoManagerStorager.updateStreamProxy(param); videoManagerStorager.updateStreamProxy(param);
} }
}else {
streamLive = true;
StreamInfo streamInfo = mediaService.getStreamInfoByAppAndStream(
mediaInfo, param.getApp(), param.getStream(), null);
wvpResult.setData(streamInfo);
} }
} }
}else { }else {
@ -202,8 +201,10 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
platformGbStreamMapper.delByAppAndStream(app, stream); platformGbStreamMapper.delByAppAndStream(app, stream);
// TODO 如果关联的推流, 那么状态设置为离线 // TODO 如果关联的推流, 那么状态设置为离线
} }
redisCatchStorage.removeStream(streamProxyItem.getMediaServerId(), "PULL", app, stream);
} }
} }
@Override @Override

Loading…
Cancel
Save