Merge pull request #1453 from BradyXs/master

fix: 系统启动时,停止已启动国标推流抛出异常被系统捕获,启动服务失败。
pull/1455/head
648540858 2024-05-16 09:08:07 +08:00 committed by GitHub
commit b3eba418a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 89 additions and 50 deletions

View File

@ -104,7 +104,7 @@ public class SipRunner implements CommandLineRunner {
redisCatchStorage.deleteSendRTPServer(sendRtpItem.getPlatformId(),sendRtpItem.getChannelId(), sendRtpItem.getCallId(),sendRtpItem.getStream());
if (mediaServerItem != null) {
ssrcFactory.releaseSsrc(sendRtpItem.getMediaServerId(), sendRtpItem.getSsrc());
boolean stopResult = mediaServerService.stopSendRtp(mediaServerItem, sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getSsrc());
boolean stopResult = mediaServerService.initStopSendRtp(mediaServerItem, sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getSsrc());
if (stopResult) {
ParentPlatform platform = platformService.queryPlatformByServerGBId(sendRtpItem.getPlatformId());
if (platform != null) {

View File

@ -29,6 +29,8 @@ public interface IMediaNodeServerService {
boolean stopSendRtp(MediaServer mediaInfo, String app, String stream, String ssrc);
boolean initStopSendRtp(MediaServer mediaInfo, String app, String stream, String ssrc);
boolean deleteRecordDirectory(MediaServer mediaServer, String app, String stream, String date, String fileName);
List<StreamInfo> getMediaList(MediaServer mediaServer, String app, String stream, String callId);

View File

@ -76,6 +76,8 @@ public interface IMediaServerService {
boolean stopSendRtp(MediaServer mediaInfo, String app, String stream, String ssrc);
boolean initStopSendRtp(MediaServer mediaInfo, String app, String stream, String ssrc);
boolean deleteRecordDirectory(MediaServer mediaServerItem, String app, String stream, String date, String fileName);
List<StreamInfo> getMediaList(MediaServer mediaInfo, String app, String stream, String callId);

View File

@ -595,6 +595,16 @@ public class MediaServerServiceImpl implements IMediaServerService {
return mediaNodeServerService.stopSendRtp(mediaInfo, app, stream, ssrc);
}
@Override
public boolean initStopSendRtp(MediaServer mediaInfo, String app, String stream, String ssrc) {
IMediaNodeServerService mediaNodeServerService = nodeServerServiceMap.get(mediaInfo.getType());
if (mediaNodeServerService == null) {
logger.info("[stopSendRtp] 失败, mediaServer的类型 {},未找到对应的实现类", mediaInfo.getType());
return false;
}
return mediaNodeServerService.initStopSendRtp(mediaInfo, app, stream, ssrc);
}
@Override
public boolean deleteRecordDirectory(MediaServer mediaServer, String app, String stream, String date, String fileName) {
IMediaNodeServerService mediaNodeServerService = nodeServerServiceMap.get(mediaServer.getType());

View File

@ -144,6 +144,23 @@ public class ZLMMediaNodeServerService implements IMediaNodeServerService {
}
@Override
public boolean initStopSendRtp(MediaServer mediaInfo, String app, String stream, String ssrc) {
Map<String, Object> param = new HashMap<>();
param.put("vhost", "__defaultVhost__");
param.put("app", app);
param.put("stream", stream);
if (!ObjectUtils.isEmpty(ssrc)) {
param.put("ssrc", ssrc);
}
JSONObject jsonObject = zlmresTfulUtils.stopSendRtp(mediaInfo, param);
if (jsonObject == null || jsonObject.getInteger("code") != 0 ) {
logger.error("停止发流失败: {}, 参数:{}", jsonObject.getString("msg"), JSON.toJSONString(param));
return false;
}
return true;
}
@Override
public boolean deleteRecordDirectory(MediaServer mediaServer, String app, String stream, String date, String fileName) {
logger.info("[zlm-deleteRecordDirectory] 删除磁盘文件, server: {} {}:{}->{}/{}", mediaServer.getId(), app, stream, date, fileName);

View File

@ -34,7 +34,7 @@
<el-form-item label="本地IP" prop="deviceIp">
<el-select v-model="platform.deviceIp" placeholder="请选择与上级相通的网卡" style="width: 100%">
<el-option
v-for="ip in deviceIp"
v-for="ip in deviceIps"
:key="ip"
:label="ip"
:value="ip">
@ -109,7 +109,8 @@
<el-form-item>
<el-button type="primary" @click="onSubmit">{{
onSubmit_text
}}</el-button>
}}
</el-button>
<el-button @click="close"></el-button>
</el-form-item>
</el-form>
@ -172,7 +173,7 @@ export default {
administrativeDivision: "",
sendStreamIp: null,
},
deviceIp: [], // IP
deviceIps: [], // IP
rules: {
name: [{required: true, message: "请输入平台名称", trigger: "blur"}],
serverGBId: [
@ -190,33 +191,37 @@ export default {
keepTimeout: [{required: true, message: "请输入心跳周期", trigger: "blur"}],
transport: [{required: true, message: "请选择信令传输", trigger: "blur"}],
characterSet: [{required: true, message: "请选择编码字符集", trigger: "blur"}],
deviceIp: [{required: true, message: "请选择本地IP", trigger: "blur"}],
},
};
},
methods: {
openDialog: function (platform, callback) {
var that = this;
if (platform == null) {
this.onSubmit_text = "立即创建";
this.saveUrl = "/api/platform/add";
this.$axios({
method: 'get',
url: `/api/platform/server_config`
}).then(function (res) {
console.log(res);
if (platform == null) {
if (res.data.code === 0) {
that.platform.deviceGBId = res.data.data.username;
that.deviceIp = res.data.data.deviceIp.split(',');
that.deviceIps = res.data.data.deviceIp.split(',');
that.platform.deviceIp = that.deviceIps[0];
that.platform.devicePort = res.data.data.devicePort;
that.platform.username = res.data.data.username;
that.platform.password = res.data.data.password;
that.platform.sendStreamIp = res.data.data.sendStreamIp;
that.platform.administrativeDivision = res.data.data.username.substr(0, 6);
}
} else {
that.deviceIps = res.data.data.deviceIp.split(',');
}
}).catch(function (error) {
console.log(error);
});
if (platform == null) {
this.onSubmit_text = "立即创建";
this.saveUrl = "/api/platform/add";
} else {
this.platform.id = platform.id;
this.platform.enable = platform.enable;
@ -230,7 +235,7 @@ export default {
this.platform.serverIP = platform.serverIP;
this.platform.serverPort = platform.serverPort;
this.platform.deviceGBId = platform.deviceGBId;
this.deviceIp = platform.deviceIp.split(',');
this.platform.deviceIp = platform.deviceIp;
this.platform.devicePort = platform.devicePort;
this.platform.username = platform.username;
this.platform.password = platform.password;
@ -326,7 +331,8 @@ export default {
var that = this;
await that.$axios({
method: 'get',
url:`/api/platform/exit/${deviceGbId}`})
url: `/api/platform/exit/${deviceGbId}`
})
.then(function (res) {
if (res.data.code === 0) {
result = res.data.data;
@ -363,10 +369,12 @@ input::-webkit-inner-spin-button {
appearance: none;
margin: 0;
}
/* 火狐 */
input {
-moz-appearance: textfield;
}
.control-wrapper-not-used {
position: relative;
width: 6.25rem;