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

This commit is contained in:
648540858 2021-12-10 11:28:25 +08:00
parent faac93613a
commit 20a3cb9e73

View File

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