mirror of
https://gitee.com/pan648540858/wvp-GB28181-pro.git
synced 2026-05-27 15:37:50 +08:00
解决单端口兼容宇视平台
This commit is contained in:
parent
3cd3e97cd7
commit
24c3f459f2
@ -14,6 +14,11 @@ public interface IInviteStreamService {
|
||||
*/
|
||||
void updateInviteInfo(InviteInfo inviteInfo);
|
||||
|
||||
/**
|
||||
* 新增点播的状态信息
|
||||
*/
|
||||
void insertInviteInfo(InviteInfo inviteInfo);
|
||||
|
||||
InviteInfo updateInviteInfoForStream(InviteInfo inviteInfo, String stream);
|
||||
|
||||
/**
|
||||
@ -31,6 +36,16 @@ public interface IInviteStreamService {
|
||||
String deviceId,
|
||||
String channelId,
|
||||
String stream);
|
||||
|
||||
/**
|
||||
* 移除点播的状态信息
|
||||
*/
|
||||
void removeInviteInfo(InviteSessionType type,
|
||||
String deviceId,
|
||||
String channelId,
|
||||
String stream,
|
||||
String ssrc);
|
||||
|
||||
/**
|
||||
* 移除点播的状态信息
|
||||
*/
|
||||
|
||||
@ -121,6 +121,23 @@ public class InviteStreamServiceImpl implements IInviteStreamService {
|
||||
redisTemplate.opsForValue().set(key, inviteInfoForUpdate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertInviteInfo(InviteInfo inviteInfo) {
|
||||
if (inviteInfo == null || (inviteInfo.getDeviceId() == null || inviteInfo.getChannelId() == null)) {
|
||||
logger.warn("[更新Invite信息],参数不全: {}", JSON.toJSON(inviteInfo));
|
||||
return;
|
||||
}
|
||||
InviteInfo inviteInfoForUpdate = inviteInfo;
|
||||
|
||||
String key = VideoManagerConstants.INVITE_PREFIX +
|
||||
":" + inviteInfoForUpdate.getType() +
|
||||
":" + inviteInfoForUpdate.getDeviceId() +
|
||||
":" + inviteInfoForUpdate.getChannelId() +
|
||||
":" + inviteInfoForUpdate.getStream()+
|
||||
":" + inviteInfoForUpdate.getSsrcInfo().getSsrc();
|
||||
redisTemplate.opsForValue().set(key, inviteInfoForUpdate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InviteInfo updateInviteInfoForStream(InviteInfo inviteInfo, String stream) {
|
||||
|
||||
@ -194,6 +211,19 @@ public class InviteStreamServiceImpl implements IInviteStreamService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeInviteInfo(InviteSessionType type, String deviceId, String channelId, String stream, String ssrc) {
|
||||
String key = VideoManagerConstants.INVITE_PREFIX +
|
||||
":" + (type != null ? type : "*") +
|
||||
":" + (deviceId != null ? deviceId : "*") +
|
||||
":" + (channelId != null ? channelId : "*") +
|
||||
":" + (stream != null ? stream : "*") +
|
||||
":" + (ssrc != null ? ssrc : "*");
|
||||
|
||||
logger.warn("删除指定key:{}", key);
|
||||
redisTemplate.delete(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeInviteInfoByDeviceAndChannel(InviteSessionType inviteSessionType, String deviceId, String channelId) {
|
||||
removeInviteInfo(inviteSessionType, deviceId, channelId, null);
|
||||
|
||||
@ -921,17 +921,35 @@ public class PlayServiceImpl implements IPlayService {
|
||||
}
|
||||
}
|
||||
}else {
|
||||
if (ssrcInResponse != null) {
|
||||
// 单端口
|
||||
// 重新订阅流上线
|
||||
SsrcTransaction ssrcTransaction = streamSession.getSsrcTransaction(inviteInfo.getDeviceId(),
|
||||
inviteInfo.getChannelId(), null, inviteInfo.getStream());
|
||||
streamSession.remove(inviteInfo.getDeviceId(),
|
||||
inviteInfo.getChannelId(), inviteInfo.getStream());
|
||||
inviteStreamService.updateInviteInfoForSSRC(inviteInfo, ssrcInResponse);
|
||||
streamSession.put(device.getDeviceId(), channelId, ssrcTransaction.getCallId(),
|
||||
inviteInfo.getStream(), ssrcInResponse, mediaServerItem.getId(), (SIPResponse) responseEvent.getResponse(), inviteSessionType);
|
||||
//1.将ssrc释放回队列
|
||||
mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
|
||||
//2.redis中获取此ssrc的数据
|
||||
InviteInfo inviteInfoBySSRC = inviteStreamService.getInviteInfoBySSRC(ssrcInfo.getSsrc());
|
||||
//3.如果redis中有此数据则删除+替换ssrc
|
||||
if(inviteInfoBySSRC != null){
|
||||
//删除
|
||||
inviteStreamService.removeInviteInfo(
|
||||
InviteSessionType.PLAY,
|
||||
inviteInfoBySSRC.getDeviceId(),
|
||||
inviteInfoBySSRC.getChannelId(),
|
||||
inviteInfoBySSRC.getStream(),
|
||||
ssrcInfo.getSsrc());
|
||||
//添加
|
||||
ssrcInfo.setSsrc(ssrcInResponse);
|
||||
inviteInfo.setSsrcInfo(ssrcInfo);
|
||||
inviteInfo.setStream(ssrcInfo.getStream());
|
||||
inviteStreamService.insertInviteInfo(inviteInfoBySSRC);
|
||||
}
|
||||
|
||||
// 单端口
|
||||
// 重新订阅流上线
|
||||
SsrcTransaction ssrcTransaction = streamSession.getSsrcTransaction(inviteInfo.getDeviceId(),
|
||||
inviteInfo.getChannelId(), null, inviteInfo.getStream());
|
||||
streamSession.remove(inviteInfo.getDeviceId(),
|
||||
inviteInfo.getChannelId(), inviteInfo.getStream());
|
||||
inviteStreamService.updateInviteInfoForSSRC(inviteInfo, ssrcInResponse);
|
||||
streamSession.put(device.getDeviceId(), channelId, ssrcTransaction.getCallId(),
|
||||
inviteInfo.getStream(), ssrcInResponse, mediaServerItem.getId(), (SIPResponse) responseEvent.getResponse(), inviteSessionType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user