Переглянути джерело

V0.3.5
1、修改了RTP服务IP获取方式,从配置动态库中获取

Apple 5 днів тому
батько
коміт
bc2a8a965e

+ 2 - 2
RTPServer/RtpOneRoadThread.cpp

@@ -221,9 +221,9 @@ bool RTPOneRoadThread::processUdpState()
 
     if(m_udpState == eUDPState::eUDP_Init)
     {
-        if(!m_udpSocket->bind(QHostAddress(m_localIP), m_localPort))
+        if(!m_udpSocket->bind(QHostAddress(m_localIP)))
         {
-            SPDLOG_LOGGER_ERROR(m_logger, "{} 绑定UDP套接字失败: {}:{}", m_logBase, m_localIP.toStdString(), m_localPort);
+            SPDLOG_LOGGER_ERROR(m_logger, "{} 绑定UDP套接字失败: {}:{}", m_logBase, m_localIP.toStdString(), m_udpSocket->localPort());
             return false;
         }
         SPDLOG_LOGGER_INFO(m_logger, "{} 绑定UDP套接字到本地IP: {}:{}", m_logBase, 

+ 6 - 1
RTPServer/RtpServer.cpp

@@ -6,6 +6,7 @@
 
 #include "ThreadManager.h"
 #include "ThreadCompareItemManager.h"
+#include "SystemConfig.h"
 
 
 RTPServer::RTPServer(QObject *parent)
@@ -54,7 +55,11 @@ bool RTPServer::thread_task(int port)
     }
 
     /* 查找到出口IP */
-    m_localIP = "192.1.2.118";
+    m_localIP = SysConfig.getBaseConfigSrc().strServerIP;
+    if(m_localIP.isEmpty())
+    {
+        SPDLOG_LOGGER_ERROR(m_logger, "未设置服务器出口IP,无法监听客户端连接");
+    }
 
     /* 开启事件循环 */
     connect(m_tcpServer, &QTcpServer::newConnection, this, &RTPServer::do_newConnection);

+ 6 - 0
SettingLibrary/Modules/Basic/basicwidget.cpp

@@ -38,6 +38,12 @@ BasicWidget::BasicWidget(QWidget *parent) :
     ui->comBox_driverName->setViewShadowEffect();
     ui->comBox_recordMode->setViewShadowEffect();
 
+    /* 设置IP地址格式限制 */
+    QRegularExpression ipRegex(R"(^(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)){3}$)");
+    QValidator *ipValidator = new QRegularExpressionValidator(ipRegex, this);
+    ui->lineEdit_serverIP->setValidator(ipValidator);
+    
+
     /* 初始化数据 */
     /* 设置录音模式 */
     for(auto it = g_mapRecordModes.begin(); it != g_mapRecordModes.end(); ++it)