From 504eaab19115cad29fe1fe91f1bb478052ac4196 Mon Sep 17 00:00:00 2001
From: zhaowenyu <35589726@qq.com>
Date: Thu, 02 Apr 2026 16:50:29 +0800
Subject: [PATCH] 2026-04-02 优化机场视频推流顺序;在RTMP中先入库再推流,在RTSP单独推流。

---
 ard-sample/src/main/java/com/ard/sample/manage/service/impl/LiveStreamServiceImpl.java |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/ard-sample/src/main/java/com/ard/sample/manage/service/impl/LiveStreamServiceImpl.java b/ard-sample/src/main/java/com/ard/sample/manage/service/impl/LiveStreamServiceImpl.java
index 5330d79..bcdf6c6 100644
--- a/ard-sample/src/main/java/com/ard/sample/manage/service/impl/LiveStreamServiceImpl.java
+++ b/ard-sample/src/main/java/com/ard/sample/manage/service/impl/LiveStreamServiceImpl.java
@@ -180,9 +180,20 @@
 //                    live.setRtspUrl(rtspUrl);
 //                    live.setWebrtcUrl(webrtcUrl);
 //                }
+                receiveReply = this.publishLiveStart(respTopic, liveParam);
 
+                if (ResponseResult.CODE_SUCCESS != receiveReply.getResult()) {
+                    log.info("机场直播开启失败,错误码:{},错误描述:{}", receiveReply.getResult(), LiveErrorEnum.find(receiveReply.getResult()).getErrorMsg());
+                    return ResponseResult.error(receiveReply.getResult(), LiveErrorEnum.find(receiveReply.getResult()).getErrorMsg());
+                }
                 break;
             case RTSP:
+                receiveReply = this.publishLiveStart(respTopic, liveParam);
+
+                if (ResponseResult.CODE_SUCCESS != receiveReply.getResult()) {
+                    log.info("机场直播开启失败,错误码:{},错误描述:{}", receiveReply.getResult(), LiveErrorEnum.find(receiveReply.getResult()).getErrorMsg());
+                    return ResponseResult.error(receiveReply.getResult(), LiveErrorEnum.find(receiveReply.getResult()).getErrorMsg());
+                }
                 Object url = Objects.requireNonNullElse(receiveReply.getOutput(), receiveReply.getInfo());
                 this.resolveUrlUser(String.valueOf(url), live);
                 break;
@@ -190,12 +201,7 @@
                 return ResponseResult.error(LiveErrorEnum.URL_TYPE_NOT_SUPPORTED);
         }
 
-        receiveReply = this.publishLiveStart(respTopic, liveParam);
 
-        if (ResponseResult.CODE_SUCCESS != receiveReply.getResult()) {
-            log.info("机场直播开启失败,错误码:{},错误描述:{}", receiveReply.getResult(), LiveErrorEnum.find(receiveReply.getResult()).getErrorMsg());
-            return ResponseResult.error(receiveReply.getResult(), LiveErrorEnum.find(receiveReply.getResult()).getErrorMsg());
-        }
 
         // 开始直播时发送机场相机摄像头默认信息(舱外)到所有在线用户,只取机场sn,发机场的摄像头信息
         if(data.getChildDeviceSn()!=null) {

--
Gitblit v1.9.3