From 9734b7bf00155302bb0b39d1198f7649a00b8cde Mon Sep 17 00:00:00 2001 From: weishao Date: Wed, 19 Jul 2023 16:41:43 +0800 Subject: [PATCH] =?UTF-8?q?rtc=20udp/tcp=20port=20=E9=BB=98=E8=AE=A48000?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/main.cpp | 10 ---------- src/Common/config.cpp | 17 ---------------- src/Common/config.h | 9 --------- webrtc/WebRtcTransport.cpp | 41 ++++++++++++++++++++++---------------- webrtc/WebRtcTransport.h | 7 +++++++ 5 files changed, 31 insertions(+), 53 deletions(-) diff --git a/server/main.cpp b/server/main.cpp index f6a9df7b..f4140bf6 100644 --- a/server/main.cpp +++ b/server/main.cpp @@ -102,16 +102,6 @@ onceToken token1([](){ },nullptr); } //namespace RtpProxy -// RTC配置项目 -namespace Rtc { -#define RTC_FIELD "rtc." -const string kPort = RTC_FIELD "port"; -const string kTcpPort = RTC_FIELD "tcpPort"; -onceToken token1([]() { - mINI::Instance()[kPort] = 8000; - mINI::Instance()[kTcpPort] = 8000; -},nullptr); -} // namespace RTC } // namespace mediakit diff --git a/src/Common/config.cpp b/src/Common/config.cpp index 18a862f0..7abc0ca9 100644 --- a/src/Common/config.cpp +++ b/src/Common/config.cpp @@ -260,23 +260,6 @@ static onceToken token([]() { }); } // namespace Rtp -////////////RTC服务器配置/////////// -namespace Rtc { -#define RTC_FIELD "rtc." -// rtp和rtcp接受超时时间 -const string kTimeOutSec = RTC_FIELD "timeoutSec"; -// 服务器外网ip -const string kExternIP = RTC_FIELD "externIP"; -// 设置remb比特率,非0时关闭twcc并开启remb。该设置在rtc推流时有效,可以控制推流画质 -const string kRembBitRate = RTC_FIELD "rembBitRate"; - -static onceToken token([]() { - mINI::Instance()[kTimeOutSec] = 15; - mINI::Instance()[kExternIP] = ""; - mINI::Instance()[kRembBitRate] = 0; -}); - -} // namespace RTC ////////////组播配置/////////// namespace MultiCast { diff --git a/src/Common/config.h b/src/Common/config.h index 534d6f40..38c8c1a0 100644 --- a/src/Common/config.h +++ b/src/Common/config.h @@ -308,15 +308,6 @@ extern const std::string kLowLatency; extern const std::string kH264StapA; } // namespace Rtp -////////////RTC服务器配置/////////// -namespace Rtc { -//rtc播放推流、播放超时时间 -extern const std::string kTimeOutSec; -// 服务器外网ip -extern const std::string kExternIP; -// 设置remb比特率,非0时关闭twcc并开启remb。该设置在rtc推流时有效,可以控制推流画质 -extern const std::string kRembBitRate; -} // namespace Rtc ////////////组播配置/////////// namespace MultiCast { diff --git a/webrtc/WebRtcTransport.cpp b/webrtc/WebRtcTransport.cpp index 5bb93dc1..b87647db 100644 --- a/webrtc/WebRtcTransport.cpp +++ b/webrtc/WebRtcTransport.cpp @@ -32,27 +32,34 @@ #define RTP_MSLABEL "zlmediakit-mslabel" #define RTP_MSID RTP_MSLABEL " " RTP_LABEL -namespace mediakit { -//c api RTC配置项目 -namespace Rtc { -#ifndef RTC_FIELD -#define RTC_FIELD "rtc." -// webrtc单端口udp服务器 -const std::string kPort = RTC_FIELD "port"; -const std::string kTcpPort = RTC_FIELD "tcpPort"; - -static onceToken token([]() { - mINI::Instance()[kPort] = 8000; - mINI::Instance()[kTcpPort] = 8000; -}); -#endif -} -} - using namespace std; namespace mediakit { +// RTC配置项目 +namespace Rtc { +#define RTC_FIELD "rtc." +// rtp和rtcp接受超时时间 +const string kTimeOutSec = RTC_FIELD "timeoutSec"; +// 服务器外网ip +const string kExternIP = RTC_FIELD "externIP"; +// 设置remb比特率,非0时关闭twcc并开启remb。该设置在rtc推流时有效,可以控制推流画质 +const string kRembBitRate = RTC_FIELD "rembBitRate"; +// webrtc单端口udp服务器 +const string kPort = RTC_FIELD "port"; + +const string kTcpPort = RTC_FIELD "tcpPort"; + +static onceToken token([]() { + mINI::Instance()[kTimeOutSec] = 15; + mINI::Instance()[kExternIP] = ""; + mINI::Instance()[kRembBitRate] = 0; + mINI::Instance()[kPort] = 8000; + mINI::Instance()[kTcpPort] = 8000; +}); + +} // namespace RTC + static atomic s_key { 0 }; static void translateIPFromEnv(std::vector &v) { diff --git a/webrtc/WebRtcTransport.h b/webrtc/WebRtcTransport.h index 9ef681e6..2534ca3b 100644 --- a/webrtc/WebRtcTransport.h +++ b/webrtc/WebRtcTransport.h @@ -28,6 +28,13 @@ namespace mediakit { +//RTC配置项目 +namespace Rtc { +extern const std::string kPort; +extern const std::string kTcpPort; +extern const std::string kTimeOutSec; +}//namespace RTC + class WebRtcInterface { public: WebRtcInterface() = default;