Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
6c23ab20
提交
6c23ab20
authored
12月 07, 2015
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Complete command line options and remove remaining multi-thread stuff.
上级
46f9edd8
显示空白字符变更
内嵌
并排
正在显示
15 个修改的文件
包含
40 行增加
和
31 行删除
+40
-31
Logger.h
include/Logger.h
+1
-1
DTLSHandler.h
include/RTC/DTLSHandler.h
+1
-1
SRTPSession.h
include/RTC/SRTPSession.h
+1
-1
Settings.h
include/Settings.h
+2
-0
common.h
include/common.h
+2
-0
UDPSocket.h
include/handles/UDPSocket.h
+1
-1
DepOpenSSL.cpp
src/DepOpenSSL.cpp
+2
-2
Logger.cpp
src/Logger.cpp
+3
-2
DTLSHandler.cpp
src/RTC/DTLSHandler.cpp
+3
-3
SRTPSession.cpp
src/RTC/SRTPSession.cpp
+1
-1
TCPServer.cpp
src/RTC/TCPServer.cpp
+0
-6
Settings.cpp
src/Settings.cpp
+14
-2
Crypto.cpp
src/Utils/Crypto.cpp
+2
-3
UDPSocket.cpp
src/handles/UDPSocket.cpp
+2
-2
main.cpp
src/main.cpp
+5
-6
没有找到文件。
include/Logger.h
浏览文件 @
6c23ab20
...
...
@@ -14,7 +14,7 @@ extern "C"
}
/*
* Logger facility
for MediaSoup
.
* Logger facility.
*
* If the macro MS_DEVEL is set (see below) the output is even more verbose
* (it shows the file number in each log and enables the MS_TRACE() call).
...
...
include/RTC/DTLSHandler.h
浏览文件 @
6c23ab20
...
...
@@ -60,7 +60,7 @@ namespace RTC
static
Fingerprints
fingerprints
;
typedef
std
::
vector
<
SrtpProfileMapEntry
>
SRTPProfiles
;
static
SRTPProfiles
srtpProfiles
;
static
__thread
MS_BYTE
sslReadBuffer
[];
static
MS_BYTE
sslReadBuffer
[];
public
:
DTLSHandler
(
Listener
*
listener
);
...
...
include/RTC/SRTPSession.h
浏览文件 @
6c23ab20
...
...
@@ -24,7 +24,7 @@ namespace RTC
static
void
onSRTPEvent
(
srtp_event_data_t
*
data
);
private
:
static
__thread
MS_BYTE
encryptBuffer
[];
static
MS_BYTE
encryptBuffer
[];
public
:
SRTPSession
(
Type
type
,
RTC
::
SRTPProfile
profile
,
MS_BYTE
*
key
,
size_t
key_len
);
...
...
include/Settings.h
浏览文件 @
6c23ab20
...
...
@@ -16,6 +16,7 @@ public:
struct
Configuration
{
unsigned
int
logLevel
{
LOG_DEBUG
};
bool
useSyslog
{
false
};
unsigned
int
syslogFacility
{
LOG_USER
};
struct
...
...
@@ -26,6 +27,7 @@ public:
MS_PORT
maxPort
{
59999
};
std
::
string
dtlsCertificateFile
;
std
::
string
dtlsPrivateKeyFile
;
// Private fields.
bool
hasIPv4
{
false
};
bool
hasIPv6
{
false
};
...
...
include/common.h
浏览文件 @
6c23ab20
...
...
@@ -7,6 +7,8 @@
#include <netinet/in.h> // sockaddr_in, sockaddr_in6
#include <arpa/inet.h> // htonl(), htons(), ntohl(), ntohs()
#define MS_PROCESS_NAME "mediasoup-worker"
#define MS_BYTE uint8_t
#define MS_2BYTES uint16_t
#define MS_4BYTES uint32_t
...
...
include/handles/UDPSocket.h
浏览文件 @
6c23ab20
...
...
@@ -17,7 +17,7 @@ public:
}
UvSendData
;
private
:
static
__thread
MS_BYTE
readBuffer
[];
static
MS_BYTE
readBuffer
[];
public
:
UDPSocket
(
const
std
::
string
&
ip
,
MS_PORT
port
);
...
...
src/DepOpenSSL.cpp
浏览文件 @
6c23ab20
...
...
@@ -20,12 +20,12 @@ void DepOpenSSL::ClassInit()
MS_DEBUG
(
"loaded openssl version: %s"
,
SSLeay_version
(
SSLEAY_VERSION
));
//
First i
nitialize OpenSSL stuff.
//
I
nitialize OpenSSL stuff.
SSL_load_error_strings
();
SSL_library_init
();
RAND_poll
();
// Make OpenSSL thread-safe.
// Make OpenSSL thread-safe
(even if we are single thread)
.
DepOpenSSL
::
mutexes
=
new
pthread_mutex_t
[
CRYPTO_num_locks
()];
if
(
!
DepOpenSSL
::
mutexes
)
MS_THROW_ERROR
(
"allocation of mutexes failed"
);
...
...
src/Logger.cpp
浏览文件 @
6c23ab20
...
...
@@ -20,8 +20,9 @@ void Logger::EnableSyslog()
{
MS_TRACE
();
// TODO: Set the process name/id as well.
openlog
(
"MediaSoup"
,
(
LOG_PID
),
Settings
::
configuration
.
syslogFacility
);
MS_DEBUG
(
"logging to Syslog"
);
openlog
(
MS_PROCESS_NAME
,
(
LOG_PID
),
Settings
::
configuration
.
syslogFacility
);
Logger
::
isSyslogEnabled
=
true
;
}
src/RTC/DTLSHandler.cpp
浏览文件 @
6c23ab20
...
...
@@ -75,7 +75,7 @@ namespace RTC
{
RTC
::
SRTPProfile
::
AES_CM_128_HMAC_SHA1_80
,
"SRTP_AES128_CM_SHA1_80"
},
{
RTC
::
SRTPProfile
::
AES_CM_128_HMAC_SHA1_32
,
"SRTP_AES128_CM_SHA1_32"
}
};
__thread
MS_BYTE
DTLSHandler
::
sslReadBuffer
[
MS_SSL_READ_BUFFER_SIZE
];
MS_BYTE
DTLSHandler
::
sslReadBuffer
[
MS_SSL_READ_BUFFER_SIZE
];
/* Static methods. */
...
...
@@ -207,8 +207,8 @@ namespace RTC
LOG_OPENSSL_ERROR
(
"X509_get_subject_name() failed"
);
goto
error
;
}
X509_NAME_add_entry_by_txt
(
cert_name
,
"O"
,
MBSTRING_ASC
,
(
unsigned
char
*
)
"Mediasoup"
,
-
1
,
-
1
,
0
);
X509_NAME_add_entry_by_txt
(
cert_name
,
"CN"
,
MBSTRING_ASC
,
(
unsigned
char
*
)
"Mediasoup"
,
-
1
,
-
1
,
0
);
X509_NAME_add_entry_by_txt
(
cert_name
,
"O"
,
MBSTRING_ASC
,
(
unsigned
char
*
)
MS_PROCESS_NAME
,
-
1
,
-
1
,
0
);
X509_NAME_add_entry_by_txt
(
cert_name
,
"CN"
,
MBSTRING_ASC
,
(
unsigned
char
*
)
MS_PROCESS_NAME
,
-
1
,
-
1
,
0
);
// It is self signed so set the issuer name to be the same as the subject.
ret
=
X509_set_issuer_name
(
DTLSHandler
::
certificate
,
cert_name
);
...
...
src/RTC/SRTPSession.cpp
浏览文件 @
6c23ab20
...
...
@@ -12,7 +12,7 @@ namespace RTC
{
/* Static variables. */
__thread
MS_BYTE
SRTPSession
::
encryptBuffer
[
MS_ENCRYPT_BUFFER_SIZE
];
MS_BYTE
SRTPSession
::
encryptBuffer
[
MS_ENCRYPT_BUFFER_SIZE
];
/* Static methods. */
...
...
src/RTC/TCPServer.cpp
浏览文件 @
6c23ab20
...
...
@@ -35,7 +35,6 @@ namespace RTC
/* Static methods. */
// NOTE: Must be called from MediaSoup::Init().
void
TCPServer
::
ClassInit
()
{
MS_TRACE
();
...
...
@@ -95,11 +94,6 @@ namespace RTC
servers
[
1
]
=
new
RTC
::
TCPServer
(
uvHandles
[
1
]);
}
/*
* By calling this method, two different workers (threads) can access to the
* static map of available ports. No problem since the map keys are not modified,
* and values are a MS_PORT (uint16_t) which is atomic.
*/
void
TCPServer
::
RandomizePort
(
int
address_family
,
uv_tcp_t
*
uvHandles
[],
bool
pair
)
{
MS_TRACE
();
...
...
src/Settings.cpp
浏览文件 @
6c23ab20
...
...
@@ -88,6 +88,7 @@ void Settings::SetConfiguration(int argc, char* argv[])
struct
option
options
[]
=
{
{
"logLevel"
,
optional_argument
,
nullptr
,
'l'
},
{
"useSyslog"
,
optional_argument
,
nullptr
,
's'
},
{
"syslogFacility"
,
optional_argument
,
nullptr
,
'f'
},
{
"rtcListenIPv4"
,
optional_argument
,
nullptr
,
'4'
},
{
"rtcListenIPv6"
,
optional_argument
,
nullptr
,
'6'
},
...
...
@@ -113,6 +114,12 @@ void Settings::SetConfiguration(int argc, char* argv[])
SetLogLevel
(
value_string
);
break
;
case
's'
:
value_string
=
std
::
string
(
optarg
);
if
(
value_string
.
compare
(
"true"
)
==
0
)
Settings
::
configuration
.
useSyslog
=
true
;
break
;
case
'f'
:
value_string
=
std
::
string
(
optarg
);
SetSyslogFacility
(
value_string
);
...
...
@@ -174,6 +181,10 @@ void Settings::SetConfiguration(int argc, char* argv[])
// Set DTLS certificate files (if provided),
Settings
::
SetDtlsCertificateAndPrivateKeyFiles
();
// Use syslog if requested.
if
(
Settings
::
configuration
.
useSyslog
)
Logger
::
EnableSyslog
();
}
void
Settings
::
PrintConfiguration
()
...
...
@@ -183,6 +194,7 @@ void Settings::PrintConfiguration()
MS_DEBUG
(
"[configuration]"
);
MS_DEBUG
(
"- logLevel:
\"
%s
\"
"
,
Settings
::
logLevel2String
[
Settings
::
configuration
.
logLevel
].
c_str
());
MS_DEBUG
(
"- useSyslog:
\"
%s
\"
"
,
Settings
::
configuration
.
useSyslog
?
"true"
:
"false"
);
MS_DEBUG
(
"- syslogFacility:
\"
%s
\"
"
,
Settings
::
syslogFacility2String
[
Settings
::
configuration
.
syslogFacility
].
c_str
());
MS_DEBUG
(
"- RTC:"
);
...
...
@@ -309,7 +321,7 @@ void Settings::SetRtcListenIPv4(const std::string &ip)
{
MS_TRACE
();
if
(
ip
.
empty
())
if
(
ip
.
empty
()
||
ip
.
compare
(
"false"
)
==
0
)
{
Settings
::
configuration
.
RTC
.
listenIPv4
.
clear
();
Settings
::
configuration
.
RTC
.
hasIPv4
=
false
;
...
...
@@ -339,7 +351,7 @@ void Settings::SetRtcListenIPv6(const std::string &ip)
{
MS_TRACE
();
if
(
ip
.
empty
())
if
(
ip
.
empty
()
||
ip
.
compare
(
"false"
)
==
0
)
{
Settings
::
configuration
.
RTC
.
listenIPv6
.
clear
();
Settings
::
configuration
.
RTC
.
hasIPv6
=
false
;
...
...
src/Utils/Crypto.cpp
浏览文件 @
6c23ab20
...
...
@@ -64,9 +64,8 @@ namespace Utils
{
MS_TRACE
();
// TODO: refactor comment
// Init the seed of each thread with a random number taken from the address
// of the seed variable itself (which is different for each thread).
// Init the vrypto seed with a random number taken from the address
// of the seed variable itself (which is random).
Crypto
::
seed
=
(
unsigned
int
)(
unsigned
long
)
&
Crypto
::
seed
;
// Create an OpenSSL HMAC_CTX context for HMAC SHA1 calculation.
...
...
src/handles/UDPSocket.cpp
浏览文件 @
6c23ab20
...
...
@@ -57,7 +57,7 @@ void on_error_close(uv_handle_t* handle)
/* Static variables. */
__thread
MS_BYTE
UDPSocket
::
readBuffer
[
MS_READ_BUFFER_SIZE
];
MS_BYTE
UDPSocket
::
readBuffer
[
MS_READ_BUFFER_SIZE
];
/* Instance methods. */
...
...
@@ -309,7 +309,7 @@ void UDPSocket::onUvRecvAlloc(size_t suggested_size, uv_buf_t* buf)
{
MS_TRACE
();
// Tell UV to write into the
per thread
buffer.
// Tell UV to write into the
static
buffer.
buf
->
base
=
(
char
*
)
UDPSocket
::
readBuffer
;
// Give UV all the buffer space.
buf
->
len
=
MS_READ_BUFFER_SIZE
;
...
...
src/main.cpp
浏览文件 @
6c23ab20
...
...
@@ -18,7 +18,6 @@
#include <string>
#include <csignal> // sigaction()
#include <cerrno>
#include <cstdint> // uint8_t, etc // TODO: remove?
static
void
init
();
static
void
ignoreSignals
();
...
...
@@ -31,10 +30,12 @@ int main(int argc, char* argv[])
if
(
argc
==
1
)
MS_EXIT_FAILURE
(
"process id must be given as first argument"
);
id
=
std
::
string
(
argv
[
1
]);
id
=
MS_PROCESS_NAME
"#"
+
std
::
string
(
argv
[
1
]);
Logger
::
Init
(
id
);
MS_INFO
(
"starting "
MS_PROCESS_NAME
);
#if defined(MS_LITTLE_ENDIAN)
MS_DEBUG
(
"detected Little-Endian CPU"
);
#elif defined(MS_BIG_ENDIAN)
...
...
@@ -46,7 +47,7 @@ int main(int argc, char* argv[])
#elif defined(INTPTR_MAX) && defined(INT64_MAX) && (INTPTR_MAX == INT64_MAX)
MS_DEBUG
(
"detected 64 bits architecture"
);
#else
MS_
NOTICE
(
"cannot determine whether the architecture is 32 or 64 bits"
);
MS_
WARN
(
"cannot determine whether the architecture is 32 or 64 bits"
);
#endif
try
...
...
@@ -58,8 +59,6 @@ int main(int argc, char* argv[])
MS_EXIT_FAILURE
(
"%s"
,
error
.
what
());
}
MS_NOTICE
(
"starting MediaSoup"
);
// Print configuration.
Settings
::
PrintConfiguration
();
...
...
@@ -77,7 +76,7 @@ int main(int argc, char* argv[])
}
destroy
();
MS_EXIT_SUCCESS
(
"MediaSoup
ends"
);
MS_EXIT_SUCCESS
(
MS_PROCESS_NAME
"
ends"
);
}
void
init
()
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论