修复上级播放后未发送redis通知的BUG

This commit is contained in:
lin
2025-11-08 21:55:38 +08:00
parent 869953b08d
commit b2f9492cc8
4 changed files with 28 additions and 10 deletions

View File

@@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.gb28181.bean;
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import com.genersoft.iot.vmp.media.bean.MediaServer;
import com.genersoft.iot.vmp.service.bean.RequestPushStreamMsg;
import lombok.Data;
@@ -236,4 +237,13 @@ public class SendRtpInfo {
}
public void setPlayTypeByChannelDataType(Integer dataType, String sessionName) {
if (dataType == ChannelDataType.STREAM_PUSH) {
this.setPlayType(InviteStreamType.PUSH);
}else if (dataType == ChannelDataType.STREAM_PROXY){
this.setPlayType(InviteStreamType.PROXY);
}else {
this.setPlayType("Play".equalsIgnoreCase(sessionName) ? InviteStreamType.PLAY : InviteStreamType.PLAYBACK);
}
}
}

View File

@@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl;
import com.genersoft.iot.vmp.common.InviteSessionType;
import com.genersoft.iot.vmp.common.VideoManagerConstants;
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import com.genersoft.iot.vmp.conf.DynamicTask;
import com.genersoft.iot.vmp.conf.SipConfig;
import com.genersoft.iot.vmp.conf.UserSetting;
@@ -190,7 +191,8 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
}
sendRtpItem.setStatus(1);
sendRtpItem.setCallId(inviteInfo.getCallId());
sendRtpItem.setPlayType("Play".equalsIgnoreCase(inviteInfo.getSessionName()) ? InviteStreamType.PLAY : InviteStreamType.PLAYBACK);
sendRtpItem.setPlayTypeByChannelDataType(channel.getDataType(), inviteInfo.getSessionName());
sendRtpItem.setServerId(streamInfo.getServerId());
sendRtpServerService.update(sendRtpItem);
String sdpIp = streamInfo.getMediaServer().getSdpIp();

View File

@@ -428,15 +428,21 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
@Override
public void sendPlatformStartPlayMsg(SendRtpInfo sendRtpItem, DeviceChannel channel, Platform platform) {
if (platform != null) {
MessageForPushChannel messageForPushChannel = MessageForPushChannel.getInstance(0, sendRtpItem.getApp(), sendRtpItem.getStream(),
channel.getDeviceId(), platform.getServerGBId(), platform.getName(), userSetting.getServerId(),
sendRtpItem.getMediaServerId());
messageForPushChannel.setPlatFormIndex(platform.getId());
String key = VideoManagerConstants.VM_MSG_STREAM_START_PLAY_NOTIFY;
log.info("[redis发送通知] 发送 推流被上级平台观看 {}: {}/{}->{}", key, sendRtpItem.getApp(), sendRtpItem.getStream(), platform.getServerGBId());
redisTemplate.convertAndSend(key, JSON.toJSON(messageForPushChannel));
if (platform == null) {
log.info("[redis发送通知] 失败, 平台信息为NULL");
return;
}
if (sendRtpItem.getPlayType() != InviteStreamType.PUSH) {
log.info("[redis发送通知] 取消, 流来源通道不是推流设备");
return;
}
MessageForPushChannel messageForPushChannel = MessageForPushChannel.getInstance(0, sendRtpItem.getApp(), sendRtpItem.getStream(),
channel.getDeviceId(), platform.getServerGBId(), platform.getName(), userSetting.getServerId(),
sendRtpItem.getMediaServerId());
messageForPushChannel.setPlatFormIndex(platform.getId());
String key = VideoManagerConstants.VM_MSG_STREAM_START_PLAY_NOTIFY;
log.info("[redis发送通知] 发送 推流被上级平台观看 {}: {}/{}->{}", key, sendRtpItem.getApp(), sendRtpItem.getStream(), platform.getServerGBId());
redisTemplate.convertAndSend(key, JSON.toJSON(messageForPushChannel));
}
@Override

View File

@@ -56,7 +56,7 @@ public interface StreamPushMapper {
" <if test='pushing == true' > AND st.pushing=true</if>" +
" <if test='pushing == false' > AND st.pushing=false </if>" +
" <if test='mediaServerId != null' > AND st.media_server_id=#{mediaServerId} </if>" +
" order by st.create_time desc" +
" order by st.pushing desc, st.create_time desc" +
" </script>"})
List<StreamPush> selectAll(@Param("query") String query, @Param("pushing") Boolean pushing, @Param("mediaServerId") String mediaServerId);