优化点播时RtpServer为正常关闭的问题
This commit is contained in:
parent
5b3dc4d595
commit
692f716788
@ -69,7 +69,7 @@ public class SIPProcessorObserver implements ISIPProcessorObserver {
|
||||
* @param requestEvent RequestEvent事件
|
||||
*/
|
||||
@Override
|
||||
@Async
|
||||
@Async("taskExecutor")
|
||||
public void processRequest(RequestEvent requestEvent) {
|
||||
String method = requestEvent.getRequest().getMethod();
|
||||
if ("NOTIFY".equalsIgnoreCase(requestEvent.getRequest().getMethod())) {
|
||||
@ -89,7 +89,7 @@ public class SIPProcessorObserver implements ISIPProcessorObserver {
|
||||
* @param responseEvent responseEvent事件
|
||||
*/
|
||||
@Override
|
||||
@Async
|
||||
@Async("taskExecutor")
|
||||
public void processResponse(ResponseEvent responseEvent) {
|
||||
Response response = responseEvent.getResponse();
|
||||
int status = response.getStatusCode();
|
||||
|
@ -102,7 +102,7 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In
|
||||
SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(platformGbId, channelId, null, callIdHeader.getCallId());
|
||||
String is_Udp = sendRtpItem.isTcp() ? "0" : "1";
|
||||
MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId());
|
||||
logger.info("收到ACK,开始向上级推流 rtp/{}", sendRtpItem.getStreamId());
|
||||
logger.info("收到ACK,rtp/{}开始向上级推流, 目标 {}:{},SSRC={}", sendRtpItem.getStreamId(), sendRtpItem.getIp(), sendRtpItem.getPort(), sendRtpItem.getSsrc());
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
param.put("vhost","__defaultVhost__");
|
||||
param.put("app",sendRtpItem.getApp());
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
||||
|
@ -253,7 +253,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||
if (ssrcInfo == null) {
|
||||
ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId, device.isSsrcCheck(), false);
|
||||
}
|
||||
logger.info("[点播开始] deviceId: {}, channelId: {}, SSRC: {}", device.getDeviceId(), channelId, ssrcInfo.getSsrc() );
|
||||
logger.info("[点播开始] deviceId: {}, channelId: {},收流端口: {}, 收流模式:{}, SSRC: {}, SSRC校验:{}", device.getDeviceId(), channelId, ssrcInfo.getPort(), device.getStreamMode(), ssrcInfo.getSsrc(), device.isSsrcCheck() );
|
||||
// 超时处理
|
||||
String timeOutTaskKey = UUID.randomUUID().toString();
|
||||
SSRCInfo finalSsrcInfo = ssrcInfo;
|
||||
@ -262,12 +262,12 @@ public class PlayServiceImpl implements IPlayService {
|
||||
|
||||
SIPDialog dialog = streamSession.getDialogByStream(device.getDeviceId(), channelId, finalSsrcInfo.getStream());
|
||||
if (dialog != null) {
|
||||
logger.info("[点播超时] 收流超时 deviceId: {}, channelId: {}", device.getDeviceId(), channelId);
|
||||
logger.info("[点播超时] 收流超时 deviceId: {}, channelId: {},端口:{}, SSRC: {}", device.getDeviceId(), channelId, finalSsrcInfo.getPort(), finalSsrcInfo.getSsrc());
|
||||
timeoutCallback.run(1, "收流超时");
|
||||
// 点播超时回复BYE 同时释放ssrc以及此次点播的资源
|
||||
cmder.streamByeCmd(device.getDeviceId(), channelId, finalSsrcInfo.getStream(), null);
|
||||
}else {
|
||||
logger.info("[点播超时] 消息未响应 deviceId: {}, channelId: {}", device.getDeviceId(), channelId);
|
||||
logger.info("[点播超时] 消息未响应 deviceId: {}, channelId: {},端口:{}, SSRC: {}", device.getDeviceId(), channelId, finalSsrcInfo.getPort(), finalSsrcInfo.getSsrc());
|
||||
timeoutCallback.run(0, "点播超时");
|
||||
mediaServerService.releaseSsrc(mediaServerItem.getId(), finalSsrcInfo.getSsrc());
|
||||
mediaServerService.closeRTPServer(mediaServerItem, finalSsrcInfo.getStream());
|
||||
|
@ -394,6 +394,9 @@ export default {
|
||||
console.log(this.videoUrl)
|
||||
},
|
||||
openDialog: function (tab, deviceId, channelId, param) {
|
||||
if (this.showVideoDialog) {
|
||||
return;
|
||||
}
|
||||
this.tabActiveName = tab;
|
||||
this.channelId = channelId;
|
||||
this.deviceId = deviceId;
|
||||
|
Loading…
Reference in New Issue
Block a user