From 5e82aa5f39981e6ba0909a493f091954cebd24c8 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期四, 20 六月 2024 20:04:48 +0800
Subject: [PATCH] 优化拉流代理国标级联点播

---
 src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java |   28 ++++++++++++++++++++++++----
 1 files changed, 24 insertions(+), 4 deletions(-)

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 a7c5f72..9f09e8a 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
@@ -497,6 +497,20 @@
     }
 
     @Override
+    public MediaInfo getProxyStream(String app, String streamId) {
+        String scanKey = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX  + userSetting.getServerId() + "_PULL_" + app + "_" + streamId + "_*";
+
+        MediaInfo result = null;
+        List<Object> keys = RedisUtil.scan(redisTemplate, scanKey);
+        if (keys.size() > 0) {
+            String key = (String) keys.get(0);
+            result = JsonUtil.redisJsonToObject(redisTemplate, key, MediaInfo.class);
+        }
+
+        return result;
+    }
+
+    @Override
     public void addCpuInfo(double cpuInfo) {
         String key = VideoManagerConstants.SYSTEM_INFO_CPU_PREFIX + userSetting.getServerId();
         Map<String, String> infoMap = new HashMap<>();
@@ -656,10 +670,16 @@
     }
 
     @Override
-    public void sendPlatformStartPlayMsg(MessageForPushChannel msg) {
-        String key = VideoManagerConstants.VM_MSG_STREAM_START_PLAY_NOTIFY;
-        logger.info("[redis鍙戦�侀�氱煡] 鍙戦�� 鎺ㄦ祦琚笂绾у钩鍙拌鐪� {}: {}/{}->{}", key, msg.getApp(), msg.getStream(), msg.getPlatFormId());
-        redisTemplate.convertAndSend(key, JSON.toJSON(msg));
+    public void sendPlatformStartPlayMsg(SendRtpItem sendRtpItem, ParentPlatform platform) {
+        if (sendRtpItem.getPlayType() == InviteStreamType.PUSH && platform  != null) {
+            MessageForPushChannel messageForPushChannel = MessageForPushChannel.getInstance(0, sendRtpItem.getApp(), sendRtpItem.getStream(),
+                    sendRtpItem.getChannelId(), platform.getServerGBId(), platform.getName(), userSetting.getServerId(),
+                    sendRtpItem.getMediaServerId());
+            messageForPushChannel.setPlatFormIndex(platform.getId());
+            String key = VideoManagerConstants.VM_MSG_STREAM_START_PLAY_NOTIFY;
+            logger.info("[redis鍙戦�侀�氱煡] 鍙戦�� 鎺ㄦ祦琚笂绾у钩鍙拌鐪� {}: {}/{}->{}", key, sendRtpItem.getApp(), sendRtpItem.getStream(), platform.getServerGBId());
+            redisTemplate.convertAndSend(key, JSON.toJSON(messageForPushChannel));
+        }
     }
 
     @Override

--
Gitblit v1.8.0