优化点播时RtpServer为正常关闭的问题

This commit is contained in:
648540858
2022-09-16 18:02:56 +08:00
parent 5b3dc4d595
commit 692f716788
7 changed files with 24 additions and 10 deletions

View File

@@ -98,7 +98,18 @@ public class ZLMRTPServerFactory {
result = rtpInfo.getInteger("local_port");
if (result == 0) {
// 此时说明rtpServer已经创建但是流还没有推上来
// 此时重新打开rtpServer
Map<String, Object> param = new HashMap<>();
param.put("stream_id", streamId);
JSONObject jsonObject = zlmresTfulUtils.closeRtpServer(mediaServerItem, param);
if (jsonObject != null ) {
System.out.println(jsonObject);
if (jsonObject.getInteger("code") == 0) {
return createRTPServer(mediaServerItem, streamId, ssrc, port);
}else {
logger.warn("[开启rtpServer], 重启RtpServer错误");
}
}
}
return result;
}

View File

@@ -104,7 +104,7 @@ public class ZLMRunner implements CommandLineRunner {
}, 60 * 1000 );
}
@Async
@Async("taskExecutor")
public void connectZlmServer(MediaServerItem mediaServerItem){
String connectZlmServerTaskKey = "connect-zlm-" + mediaServerItem.getId();
ZLMServerConfig zlmServerConfigFirst = getMediaServerConfig(mediaServerItem);

View File

@@ -36,7 +36,7 @@ public class ZLMStatusEventListener {
@Autowired
private IPlayService playService;
@Async
@Async("taskExecutor")
@EventListener
public void onApplicationEvent(ZLMOnlineEvent event) {
logger.info("[ZLM] 上线 ID" + event.getMediaServerId());
@@ -45,7 +45,7 @@ public class ZLMStatusEventListener {
playService.zlmServerOnline(event.getMediaServerId());
}
@Async
@Async("taskExecutor")
@EventListener
public void onApplicationEvent(ZLMOfflineEvent event) {