From b2f9492cc82abe306d3f803770f66e5d75f5e41a Mon Sep 17 00:00:00 2001
From: lin <648540858@qq.com>
Date: Sat, 8 Nov 2025 21:55:38 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=8A=E7=BA=A7=E6=92=AD?=
=?UTF-8?q?=E6=94=BE=E5=90=8E=E6=9C=AA=E5=8F=91=E9=80=81redis=E9=80=9A?=
=?UTF-8?q?=E7=9F=A5=E7=9A=84BUG?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../iot/vmp/gb28181/bean/SendRtpInfo.java | 10 +++++++++
.../request/impl/InviteRequestProcessor.java | 4 +++-
.../storager/impl/RedisCatchStorageImpl.java | 22 ++++++++++++-------
.../vmp/streamPush/dao/StreamPushMapper.java | 2 +-
4 files changed, 28 insertions(+), 10 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SendRtpInfo.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SendRtpInfo.java
index 0fc612ac5..0cfc21cbb 100755
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SendRtpInfo.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SendRtpInfo.java
@@ -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);
+ }
+ }
}
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
index c2439c805..6daf12133 100755
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
@@ -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();
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
index b759c90ae..7e45bc596 100755
--- a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
@@ -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
diff --git a/src/main/java/com/genersoft/iot/vmp/streamPush/dao/StreamPushMapper.java b/src/main/java/com/genersoft/iot/vmp/streamPush/dao/StreamPushMapper.java
index 3f5bcdcec..39b7d13ca 100755
--- a/src/main/java/com/genersoft/iot/vmp/streamPush/dao/StreamPushMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/streamPush/dao/StreamPushMapper.java
@@ -56,7 +56,7 @@ public interface StreamPushMapper {
" AND st.pushing=true" +
" AND st.pushing=false " +
" AND st.media_server_id=#{mediaServerId} " +
- " order by st.create_time desc" +
+ " order by st.pushing desc, st.create_time desc" +
" "})
List selectAll(@Param("query") String query, @Param("pushing") Boolean pushing, @Param("mediaServerId") String mediaServerId);