diff --git a/server/main.cpp b/server/main.cpp index d09bf5d5..f6a9df7b 100644 --- a/server/main.cpp +++ b/server/main.cpp @@ -102,6 +102,17 @@ 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 52c79091..18a862f0 100644 --- a/src/Common/config.cpp +++ b/src/Common/config.cpp @@ -260,6 +260,24 @@ 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 { #define MULTI_FIELD "multicast." diff --git a/src/Common/config.h b/src/Common/config.h index ec546a17..534d6f40 100644 --- a/src/Common/config.h +++ b/src/Common/config.h @@ -308,6 +308,16 @@ 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 031710e8..56895ae0 100644 --- a/webrtc/WebRtcTransport.cpp +++ b/webrtc/WebRtcTransport.cpp @@ -36,30 +36,6 @@ 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] = 0; - mINI::Instance()[kTcpPort] = 0; -}); - -} // namespace RTC - static atomic s_key { 0 }; static void translateIPFromEnv(std::vector &v) {