提交 d065ad7a authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Merge branch 'master' into test-rtp

......@@ -66,8 +66,8 @@
#include <cstdlib> // std::abort()
#define MS_LOGGER_BUFFER_SIZE 10000
#define _MS_TAG_ENABLED(tag) Settings::logTags.tag
#define _MS_TAG_ENABLED_2(tag1, tag2) (Settings::logTags.tag1 || Settings::logTags.tag2)
#define _MS_TAG_ENABLED(tag) Settings::configuration.logTags.tag
#define _MS_TAG_ENABLED_2(tag1, tag2) (Settings::configuration.logTags.tag1 || Settings::configuration.logTags.tag2)
#ifdef MS_LOG_DEV
#define _MS_LOG_DEV_ENABLED true
#else
......
......@@ -11,23 +11,6 @@
class Settings
{
public:
// Struct holding the configuration.
struct Configuration
{
LogLevel logLevel { LogLevel::LOG_DEBUG };
std::string rtcListenIPv4;
std::string rtcListenIPv6;
uint16_t rtcMinPort { 10000 };
uint16_t rtcMaxPort { 59999 };
std::string dtlsCertificateFile;
std::string dtlsPrivateKeyFile;
// Private fields.
bool hasIPv4 { false };
bool hasIPv6 { false };
};
public:
// Log tags.
struct LogTags
{
bool info { false };
......@@ -39,6 +22,23 @@ public:
// TODO: Add more tags (here and in Settings.cpp).
};
public:
// Struct holding the configuration.
struct Configuration
{
LogLevel logLevel { LogLevel::LOG_DEBUG };
struct LogTags logTags;
std::string rtcListenIPv4;
std::string rtcListenIPv6;
uint16_t rtcMinPort { 10000 };
uint16_t rtcMaxPort { 59999 };
std::string dtlsCertificateFile;
std::string dtlsPrivateKeyFile;
// Private fields.
bool hasIPv4 { false };
bool hasIPv6 { false };
};
public:
static void SetConfiguration(int argc, char* argv[]);
static void PrintConfiguration();
......@@ -56,7 +56,6 @@ private:
public:
static struct Configuration configuration;
static struct LogTags logTags;
private:
static std::map<std::string, LogLevel> string2LogLevel;
......
......@@ -22,7 +22,6 @@ bool IsBindableIP(const std::string &ip, int family, int* _bind_err);
/* Class variables. */
struct Settings::Configuration Settings::configuration;
struct Settings::LogTags Settings::logTags;
std::map<std::string, LogLevel> Settings::string2LogLevel =
{
{ "debug", LogLevel::LOG_DEBUG },
......@@ -157,17 +156,17 @@ void Settings::PrintConfiguration()
std::vector<std::string> log_tags;
if (Settings::logTags.info)
if (Settings::configuration.logTags.info)
log_tags.push_back("info");
if (Settings::logTags.ice)
if (Settings::configuration.logTags.ice)
log_tags.push_back("ice");
if (Settings::logTags.dtls)
if (Settings::configuration.logTags.dtls)
log_tags.push_back("dtls");
if (Settings::logTags.rtp)
if (Settings::configuration.logTags.rtp)
log_tags.push_back("rtp");
if (Settings::logTags.srtp)
if (Settings::configuration.logTags.srtp)
log_tags.push_back("srtp");
if (Settings::logTags.rtcp)
if (Settings::configuration.logTags.rtcp)
log_tags.push_back("rtcp");
MS_DEBUG_TAG(info, "<configuration>");
......@@ -472,22 +471,22 @@ void Settings::SetLogTags(std::vector<std::string>& tags)
// Reset logTags.
struct LogTags newLogTags;
Settings::logTags = newLogTags;
Settings::configuration.logTags = newLogTags;
for (auto& tag : tags)
{
if (tag == "info")
Settings::logTags.info = true;
Settings::configuration.logTags.info = true;
else if (tag == "ice")
Settings::logTags.ice = true;
Settings::configuration.logTags.ice = true;
else if (tag == "dtls")
Settings::logTags.dtls = true;
Settings::configuration.logTags.dtls = true;
else if (tag == "rtp")
Settings::logTags.rtp = true;
Settings::configuration.logTags.rtp = true;
else if (tag == "srtp")
Settings::logTags.srtp = true;
Settings::configuration.logTags.srtp = true;
else if (tag == "rtcp")
Settings::logTags.rtcp = true;
Settings::configuration.logTags.rtcp = true;
}
}
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论