From 4134c73745ff63d44186ed608735ea432b244755 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期四, 21 三月 2024 22:38:56 +0800
Subject: [PATCH] 优化Track的构建

---
 src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java |   40 +++-------------------------------------
 1 files changed, 3 insertions(+), 37 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 3ecfc6c..f5d664a 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
@@ -369,40 +369,6 @@
                 subscribe.response(mediaInfo, param);
             }
 
-            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()) {
                 // 澶勭悊娴佹敞鍐岀殑閴存潈淇℃伅锛� 娴佹敞閿�杩欓噷涓嶅啀鍒犻櫎閴存潈淇℃伅锛屼笅娆℃潵浜嗘柊鐨勯壌鏉冧俊鎭細瀵瑰氨鐨勮繘琛岃鐩�
@@ -506,7 +472,7 @@
                                 callId = streamAuthorityInfo.getCallId();
                             }
                             StreamInfo streamInfoByAppAndStream = mediaService.getStreamInfoByAppAndStream(mediaInfo,
-                                    param.getApp(), param.getStream(), track, callId);
+                                    param.getApp(), param.getStream(), Track.getInstance(param), callId);
                             param.setStreamInfo(new StreamContent(streamInfoByAppAndStream));
                             redisCatchStorage.addStream(mediaInfo, type, param.getApp(), param.getStream(), param);
                             if (param.getOriginType() == OriginType.RTSP_PUSH.ordinal()
@@ -618,9 +584,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