From f96250ef45af8d4c8f52fed382da058ab9330bbf Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期四, 21 三月 2024 16:59:14 +0800
Subject: [PATCH] Merge branch 'master' into dev/abl支持

---
 src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java |   41 ++++++++++++++++++++++++++++++++++++++---
 1 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
index 4b2557d..ac68bfe 100755
--- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
+++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
@@ -18,6 +18,7 @@
 import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
 import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
 import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
+import com.genersoft.iot.vmp.media.bean.Track;
 import com.genersoft.iot.vmp.media.service.IMediaServerService;
 import com.genersoft.iot.vmp.media.zlm.dto.*;
 import com.genersoft.iot.vmp.media.zlm.dto.hook.*;
@@ -33,6 +34,7 @@
 import com.genersoft.iot.vmp.vmanager.bean.OtherPsSendInfo;
 import com.genersoft.iot.vmp.vmanager.bean.OtherRtpSendInfo;
 import com.genersoft.iot.vmp.vmanager.bean.StreamContent;
+import org.apache.poi.ss.formula.functions.T;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -368,6 +370,39 @@
             }
 
             List<OnStreamChangedHookParam.MediaTrack> tracks = param.getTracks();
+            Track track = new Track();
+            track.setReaderCount(param.getTotalReaderCount());
+            for (OnStreamChangedHookParam.MediaTrack mediaTrack : tracks) {
+                switch (mediaTrack.getCodec_id()) {
+                    case 0:
+                        track.setVideoCodec("H264");
+                        break;
+                    case 1:
+                        track.setVideoCodec("H265");
+                        break;
+                    case 2:
+                        track.setAudioCodec("AAC");
+                        break;
+                    case 3:
+                        track.setAudioCodec("G711A");
+                        break;
+                    case 4:
+                        track.setAudioCodec("G711U");
+                        break;
+                }
+                if (mediaTrack.getSample_rate() > 0) {
+                    track.setAudioSampleRate(mediaTrack.getSample_rate());
+                }
+                if (mediaTrack.getChannels() > 0) {
+                    track.setAudioChannels(mediaTrack.getChannels());
+                }
+                if (mediaTrack.getHeight() > 0) {
+                    track.setHeight(mediaTrack.getHeight());
+                }
+                if (mediaTrack.getWidth() > 0) {
+                    track.setWidth(mediaTrack.getWidth());
+                }
+            }
             // TODO 閲嶆瀯姝ゅ閫昏緫
             if (param.isRegist()) {
                 // 澶勭悊娴佹敞鍐岀殑閴存潈淇℃伅锛� 娴佹敞閿�杩欓噷涓嶅啀鍒犻櫎閴存潈淇℃伅锛屼笅娆℃潵浜嗘柊鐨勯壌鏉冧俊鎭細瀵瑰氨鐨勮繘琛岃鐩�
@@ -471,7 +506,7 @@
                                 callId = streamAuthorityInfo.getCallId();
                             }
                             StreamInfo streamInfoByAppAndStream = mediaService.getStreamInfoByAppAndStream(mediaInfo,
-                                    param.getApp(), param.getStream(), tracks, callId);
+                                    param.getApp(), param.getStream(), track, callId);
                             param.setStreamInfo(new StreamContent(streamInfoByAppAndStream));
                             redisCatchStorage.addStream(mediaInfo, type, param.getApp(), param.getStream(), param);
                             if (param.getOriginType() == OriginType.RTSP_PUSH.ordinal()
@@ -583,9 +618,9 @@
                 }
                 // 鏀跺埌鏃犱汉瑙傜湅璇存槑娴佷篃娌℃湁鍦ㄥ線涓婄骇鎺ㄩ��
                 if (redisCatchStorage.isChannelSendingRTP(inviteInfo.getChannelId())) {
-                    List<SendRtpItem> sendRtpItems = redisCatchStorage.querySendRTPServerByChnnelId(
+                    List<SendRtpItem> sendRtpItems = redisCatchStorage.querySendRTPServerByChannelId(
                             inviteInfo.getChannelId());
-                    if (sendRtpItems.size() > 0) {
+                    if (!sendRtpItems.isEmpty()) {
                         for (SendRtpItem sendRtpItem : sendRtpItems) {
                             ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(sendRtpItem.getPlatformId());
                             try {

--
Gitblit v1.8.0