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

Merge branch 'master' into test-rtp

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