修复合并主线后语音对讲失败的问题

This commit is contained in:
648540858
2023-06-30 15:24:07 +08:00
parent c014a90cc6
commit 1458014fe3
6 changed files with 55 additions and 65 deletions

View File

@@ -235,8 +235,10 @@ public class PlayServiceImpl implements IPlayService {
sendRtpItem.setUsePs(false);
sendRtpItem.setReceiveStream(stream + "_talk");
int port = zlmrtpServerFactory.keepPort(mediaServerItem, playSsrc, null);
String callId = SipUtils.getNewCallId();
int port = zlmrtpServerFactory.keepPort(mediaServerItem, playSsrc, 0, ssrcFromCallback ->{
return redisCatchStorage.querySendRTPServer(device.getDeviceId(), channelId, null, callId) != null;
});
//端口获取失败的ssrcInfo 没有必要发送点播指令
if (port <= 0) {
logger.info("[语音对讲] 端口分配异常deviceId={},channelId={}", device.getDeviceId(), channelId);
@@ -264,7 +266,7 @@ public class PlayServiceImpl implements IPlayService {
}
}, userSetting.getPlayTimeout());
String callId = SipUtils.getNewCallId();
zlmrtpServerFactory.releasePort(mediaServerItem, playSsrc);
Map<String, Object> param = new HashMap<>(12);

View File

@@ -80,7 +80,7 @@ public class RedisPushStreamCloseResponseListener implements MessageListener {
for (SendRtpItem sendRtpItem : sendRtpItems) {
ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(sendRtpItem.getPlatformId());
// 停止向上级推流
String streamId = sendRtpItem.getStreamId();
String streamId = sendRtpItem.getStream();
Map<String, Object> param = new HashMap<>();
param.put("vhost","__defaultVhost__");
param.put("app",sendRtpItem.getApp());
@@ -88,7 +88,7 @@ public class RedisPushStreamCloseResponseListener implements MessageListener {
param.put("ssrc",sendRtpItem.getSsrc());
logger.info("[REDIS消息-推流结束] 停止向上级推流:{}", streamId);
MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId());
redisCatchStorage.deleteSendRTPServer(sendRtpItem.getPlatformId(), sendRtpItem.getChannelId(), sendRtpItem.getCallId(), sendRtpItem.getStreamId());
redisCatchStorage.deleteSendRTPServer(sendRtpItem.getPlatformId(), sendRtpItem.getChannelId(), sendRtpItem.getCallId(), sendRtpItem.getStream());
zlmrtpServerFactory.stopSendRtpStream(mediaInfo, param);
try {
@@ -98,7 +98,7 @@ public class RedisPushStreamCloseResponseListener implements MessageListener {
}
if (InviteStreamType.PUSH == sendRtpItem.getPlayType()) {
MessageForPushChannel messageForPushChannel = MessageForPushChannel.getInstance(0,
sendRtpItem.getApp(), sendRtpItem.getStreamId(), sendRtpItem.getChannelId(),
sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getChannelId(),
sendRtpItem.getPlatformId(), parentPlatform.getName(), userSetting.getServerId(), sendRtpItem.getMediaServerId());
messageForPushChannel.setPlatFormIndex(parentPlatform.getId());
redisCatchStorage.sendPlatformStopPlayMsg(messageForPushChannel);