Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
eb1115e9
提交
eb1115e9
authored
11月 23, 2015
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename class names of dependency handlers.
上级
c0fad081
隐藏空白字符变更
内嵌
并排
正在显示
21 个修改的文件
包含
161 行增加
和
124 行删除
+161
-124
DepLibSRTP.h
include/DepLibSRTP.h
+6
-6
DepLibUV.h
include/DepLibUV.h
+5
-5
DepOpenSSL.h
include/DepOpenSSL.h
+3
-3
DepUsrSCTP.h
include/DepUsrSCTP.h
+11
-0
SRTPSession.h
include/RTC/SRTPSession.h
+2
-2
DepLibSRTP.cpp
src/DepLibSRTP.cpp
+9
-13
DepLibUV.cpp
src/DepLibUV.cpp
+18
-18
DepOpenSSL.cpp
src/DepOpenSSL.cpp
+27
-29
DepUsrSCTP.cpp
src/DepUsrSCTP.cpp
+29
-0
Dispatcher.cpp
src/Dispatcher.cpp
+2
-2
MediaSoup.cpp
src/MediaSoup.cpp
+13
-10
SRTPSession.cpp
src/RTC/SRTPSession.cpp
+14
-14
TCPServer.cpp
src/RTC/TCPServer.cpp
+3
-3
UDPSocket.cpp
src/RTC/UDPSocket.cpp
+3
-3
Worker.cpp
src/Worker.cpp
+4
-4
SignalsHandler.cpp
src/handles/SignalsHandler.cpp
+2
-2
TCPConnection.cpp
src/handles/TCPConnection.cpp
+2
-2
TCPServer.cpp
src/handles/TCPServer.cpp
+2
-2
Timer.cpp
src/handles/Timer.cpp
+2
-2
UDPSocket.cpp
src/handles/UDPSocket.cpp
+2
-2
UnixStreamSocket.cpp
src/handles/UnixStreamSocket.cpp
+2
-2
没有找到文件。
include/LibSRTP.h
→
include/
Dep
LibSRTP.h
浏览文件 @
eb1115e9
#ifndef MS_LIBSRTP_H
#define MS_LIBSRTP_H
#ifndef MS_
DEP_
LIBSRTP_H
#define MS_
DEP_
LIBSRTP_H
#include <vector>
#include <srtp/srtp.h>
class
LibSRTP
class
Dep
LibSRTP
{
public
:
static
void
ClassInit
();
...
...
@@ -19,16 +19,16 @@ private:
/* Inline static methods. */
inline
bool
LibSRTP
::
IsError
(
err_status_t
code
)
bool
Dep
LibSRTP
::
IsError
(
err_status_t
code
)
{
return
(
code
!=
err_status_ok
);
}
inline
const
char
*
LibSRTP
::
GetErrorString
(
err_status_t
code
)
const
char
*
Dep
LibSRTP
::
GetErrorString
(
err_status_t
code
)
{
// This throws out_of_range if the given index is not in the vector.
return
LibSRTP
::
errors
.
at
(
code
);
return
Dep
LibSRTP
::
errors
.
at
(
code
);
}
#endif
include/LibUV.h
→
include/
Dep
LibUV.h
浏览文件 @
eb1115e9
#ifndef MS_LIBUV_H
#define MS_LIBUV_H
#ifndef MS_
DEP_
LIBUV_H
#define MS_
DEP_
LIBUV_H
#include "common.h"
#include <uv.h>
class
LibUV
class
Dep
LibUV
{
public
:
static
void
ClassInit
();
...
...
@@ -20,9 +20,9 @@ private:
/* Inline static methods. */
inline
uv_loop_t
*
LibUV
::
GetLoop
()
uv_loop_t
*
Dep
LibUV
::
GetLoop
()
{
return
LibUV
::
loop
;
return
Dep
LibUV
::
loop
;
}
#endif
include/OpenSSL.h
→
include/
Dep
OpenSSL.h
浏览文件 @
eb1115e9
#ifndef MS_OPENSSL_H
#define MS_OPENSSL_H
#ifndef MS_
DEP_
OPENSSL_H
#define MS_
DEP_
OPENSSL_H
#include "common.h"
#include <openssl/ssl.h>
...
...
@@ -11,7 +11,7 @@ struct CRYPTO_dynlock_value
pthread_mutex_t
mutex
;
};
class
OpenSSL
class
Dep
OpenSSL
{
public
:
static
void
ClassInit
();
...
...
include/DepUsrSCTP.h
0 → 100644
浏览文件 @
eb1115e9
#ifndef MS_DEP_USRSCTP_H
#define MS_DEP_USRSCTP_H
class
DepUsrSCTP
{
public
:
static
void
ClassInit
();
static
void
ClassDestroy
();
};
#endif
include/RTC/SRTPSession.h
浏览文件 @
eb1115e9
...
...
@@ -2,7 +2,7 @@
#define MS_RTC_SRTP_SESSION_H
#include "common.h"
#include "LibSRTP.h"
#include "
Dep
LibSRTP.h"
#include "RTC/SRTPProfile.h"
#include <srtp/srtp.h>
...
...
@@ -51,7 +51,7 @@ namespace RTC
{
const
char
*
error_string
;
error_string
=
LibSRTP
::
GetErrorString
(
this
->
lastError
);
error_string
=
Dep
LibSRTP
::
GetErrorString
(
this
->
lastError
);
this
->
lastError
=
(
err_status_t
)
0
;
// Reset it.
return
error_string
;
...
...
src/LibSRTP.cpp
→
src/
Dep
LibSRTP.cpp
浏览文件 @
eb1115e9
#define MS_CLASS "LibSRTP"
#define MS_CLASS "
Dep
LibSRTP"
#include "LibSRTP.h"
#include "
Dep
LibSRTP.h"
#include "MediaSoupError.h"
#include "Logger.h"
/* Static variables. */
std
::
vector
<
const
char
*>
LibSRTP
::
errors
=
std
::
vector
<
const
char
*>
Dep
LibSRTP
::
errors
=
{
// From 0 (err_status_ok) to 24 (err_status_pfkey_err).
"nothing to report (err_status_ok)"
,
...
...
@@ -38,28 +38,24 @@ std::vector<const char*> LibSRTP::errors =
/* Static methods. */
void
LibSRTP
::
ClassInit
()
void
Dep
LibSRTP
::
ClassInit
()
{
MS_TRACE
();
err_status_t
err
;
MS_DEBUG
(
"loaded libsrtp"
);
err
=
srtp_init
();
if
(
LibSRTP
::
IsError
(
err
))
MS_THROW_ERROR
(
"srtp_init() failed: %s"
,
LibSRTP
::
GetErrorString
(
err
));
if
(
Dep
LibSRTP
::
IsError
(
err
))
MS_THROW_ERROR
(
"srtp_init() failed: %s"
,
Dep
LibSRTP
::
GetErrorString
(
err
));
}
void
LibSRTP
::
ClassDestroy
()
void
Dep
LibSRTP
::
ClassDestroy
()
{
MS_TRACE
();
err_status_t
err
;
MS_DEBUG
(
"unloading libsrtp"
);
err
=
srtp_shutdown
();
if
(
LibSRTP
::
IsError
(
err
))
MS_CRIT
(
"srtp_shutdown() failed: %s"
,
LibSRTP
::
GetErrorString
(
err
));
if
(
Dep
LibSRTP
::
IsError
(
err
))
MS_CRIT
(
"srtp_shutdown() failed: %s"
,
Dep
LibSRTP
::
GetErrorString
(
err
));
}
src/LibUV.cpp
→
src/
Dep
LibUV.cpp
浏览文件 @
eb1115e9
#define MS_CLASS "LibUV"
#define MS_CLASS "
Dep
LibUV"
#include "LibUV.h"
#include "
Dep
LibUV.h"
#include "Logger.h"
/* Static variables. */
__thread
uv_loop_t
*
LibUV
::
loop
=
nullptr
;
__thread
uv_loop_t
*
Dep
LibUV
::
loop
=
nullptr
;
/* Static methods. */
void
LibUV
::
ClassInit
()
void
Dep
LibUV
::
ClassInit
()
{
MS_TRACE
();
...
...
@@ -17,41 +17,41 @@ void LibUV::ClassInit()
MS_DEBUG
(
"loaded libuv version: %s"
,
uv_version_string
());
}
void
LibUV
::
ThreadInit
()
void
Dep
LibUV
::
ThreadInit
()
{
MS_TRACE
();
int
err
;
// This should never happen.
if
(
LibUV
::
loop
)
MS_ABORT
(
"LibUV::loop alread allocated in this thread"
);
if
(
Dep
LibUV
::
loop
)
MS_ABORT
(
"
Dep
LibUV::loop alread allocated in this thread"
);
LibUV
::
loop
=
new
uv_loop_t
;
err
=
uv_loop_init
(
LibUV
::
loop
);
Dep
LibUV
::
loop
=
new
uv_loop_t
;
err
=
uv_loop_init
(
Dep
LibUV
::
loop
);
if
(
err
)
MS_ABORT
(
"uv_loop_init() failed: %s"
,
uv_strerror
(
err
));
}
void
LibUV
::
ThreadDestroy
()
void
Dep
LibUV
::
ThreadDestroy
()
{
MS_TRACE
();
// This should never happen.
if
(
!
LibUV
::
loop
)
MS_ABORT
(
"LibUV::loop was not allocated in this thread"
);
if
(
!
Dep
LibUV
::
loop
)
MS_ABORT
(
"
Dep
LibUV::loop was not allocated in this thread"
);
uv_loop_close
(
LibUV
::
loop
);
delete
LibUV
::
loop
;
uv_loop_close
(
Dep
LibUV
::
loop
);
delete
Dep
LibUV
::
loop
;
}
void
LibUV
::
RunLoop
()
void
Dep
LibUV
::
RunLoop
()
{
MS_TRACE
();
// This should never happen.
if
(
!
LibUV
::
loop
)
MS_ABORT
(
"LibUV::loop was not allocated in this thread"
);
if
(
!
Dep
LibUV
::
loop
)
MS_ABORT
(
"
Dep
LibUV::loop was not allocated in this thread"
);
uv_run
(
LibUV
::
loop
,
UV_RUN_DEFAULT
);
uv_run
(
Dep
LibUV
::
loop
,
UV_RUN_DEFAULT
);
}
src/OpenSSL.cpp
→
src/
Dep
OpenSSL.cpp
浏览文件 @
eb1115e9
#define MS_CLASS "OpenSSL"
#define MS_CLASS "
Dep
OpenSSL"
#include "OpenSSL.h"
#include "
Dep
OpenSSL.h"
#include "MediaSoupError.h"
#include "Logger.h"
#include <openssl/err.h>
...
...
@@ -9,12 +9,12 @@
/* Static attributes. */
// This array will store all of the mutex available for OpenSSL.
pthread_mutex_t
*
OpenSSL
::
mutexes
=
nullptr
;
int
OpenSSL
::
numMutexes
=
0
;
pthread_mutex_t
*
Dep
OpenSSL
::
mutexes
=
nullptr
;
int
Dep
OpenSSL
::
numMutexes
=
0
;
/* Static methods. */
void
OpenSSL
::
ClassInit
()
void
Dep
OpenSSL
::
ClassInit
()
{
MS_TRACE
();
...
...
@@ -26,32 +26,30 @@ void OpenSSL::ClassInit()
RAND_poll
();
// Make OpenSSL thread-safe.
OpenSSL
::
mutexes
=
new
pthread_mutex_t
[
CRYPTO_num_locks
()];
if
(
!
OpenSSL
::
mutexes
)
Dep
OpenSSL
::
mutexes
=
new
pthread_mutex_t
[
CRYPTO_num_locks
()];
if
(
!
Dep
OpenSSL
::
mutexes
)
MS_THROW_ERROR
(
"allocation of mutexes failed"
);
OpenSSL
::
numMutexes
=
CRYPTO_num_locks
();
Dep
OpenSSL
::
numMutexes
=
CRYPTO_num_locks
();
for
(
int
i
=
0
;
i
<
OpenSSL
::
numMutexes
;
i
++
)
for
(
int
i
=
0
;
i
<
Dep
OpenSSL
::
numMutexes
;
i
++
)
{
int
err
=
pthread_mutex_init
(
&
OpenSSL
::
mutexes
[
i
],
nullptr
);
int
err
=
pthread_mutex_init
(
&
Dep
OpenSSL
::
mutexes
[
i
],
nullptr
);
if
(
err
)
MS_THROW_ERROR
(
"pthread_mutex_init() failed with return code %d
\n
"
,
err
);
}
CRYPTO_THREADID_set_callback
(
OpenSSL
::
SetThreadId
);
CRYPTO_set_locking_callback
(
OpenSSL
::
LockingFunction
);
CRYPTO_set_dynlock_create_callback
(
OpenSSL
::
DynCreateFunction
);
CRYPTO_set_dynlock_lock_callback
(
OpenSSL
::
DynLockFunction
);
CRYPTO_set_dynlock_destroy_callback
(
OpenSSL
::
DynDestroyFunction
);
CRYPTO_THREADID_set_callback
(
Dep
OpenSSL
::
SetThreadId
);
CRYPTO_set_locking_callback
(
Dep
OpenSSL
::
LockingFunction
);
CRYPTO_set_dynlock_create_callback
(
Dep
OpenSSL
::
DynCreateFunction
);
CRYPTO_set_dynlock_lock_callback
(
Dep
OpenSSL
::
DynLockFunction
);
CRYPTO_set_dynlock_destroy_callback
(
Dep
OpenSSL
::
DynDestroyFunction
);
}
void
OpenSSL
::
ClassDestroy
()
void
Dep
OpenSSL
::
ClassDestroy
()
{
MS_TRACE
();
MS_DEBUG
(
"unloading openssl"
);
// FAQ: https://www.openssl.org/support/faq.html#PROG13
// Thread-local cleanup functions.
...
...
@@ -70,14 +68,14 @@ void OpenSSL::ClassDestroy()
sk_SSL_COMP_free
(
SSL_COMP_get_compression_methods
());
// Free mutexes.
for
(
int
i
=
0
;
i
<
OpenSSL
::
numMutexes
;
i
++
)
for
(
int
i
=
0
;
i
<
Dep
OpenSSL
::
numMutexes
;
i
++
)
{
int
err
=
pthread_mutex_destroy
(
&
OpenSSL
::
mutexes
[
i
]);
int
err
=
pthread_mutex_destroy
(
&
Dep
OpenSSL
::
mutexes
[
i
]);
if
(
err
)
MS_ERROR
(
"pthread_mutex_destroy() failed with return code %d
\n
"
,
err
);
}
if
(
OpenSSL
::
mutexes
)
delete
[]
OpenSSL
::
mutexes
;
if
(
Dep
OpenSSL
::
mutexes
)
delete
[]
Dep
OpenSSL
::
mutexes
;
// Reset callbacks.
CRYPTO_THREADID_set_callback
(
nullptr
);
...
...
@@ -87,14 +85,14 @@ void OpenSSL::ClassDestroy()
CRYPTO_set_dynlock_destroy_callback
(
nullptr
);
}
void
OpenSSL
::
SetThreadId
(
CRYPTO_THREADID
*
id
)
void
Dep
OpenSSL
::
SetThreadId
(
CRYPTO_THREADID
*
id
)
{
// MS_TRACE();
CRYPTO_THREADID_set_numeric
(
id
,
(
unsigned
long
)
pthread_self
());
}
void
OpenSSL
::
LockingFunction
(
int
mode
,
int
n
,
const
char
*
file
,
int
line
)
void
Dep
OpenSSL
::
LockingFunction
(
int
mode
,
int
n
,
const
char
*
file
,
int
line
)
{
// MS_TRACE();
...
...
@@ -112,12 +110,12 @@ void OpenSSL::LockingFunction(int mode, int n, const char *file, int line)
// MS_DEBUG("[mode: %s+%s, mutex id: %d, file: %s, line: %d]", mode & CRYPTO_LOCK ? "LOCK" : "UNLOCK", mode & CRYPTO_READ ? "READ" : "WRITE", n, file, line);
if
(
mode
&
CRYPTO_LOCK
)
pthread_mutex_lock
(
&
OpenSSL
::
mutexes
[
n
]);
pthread_mutex_lock
(
&
Dep
OpenSSL
::
mutexes
[
n
]);
else
pthread_mutex_unlock
(
&
OpenSSL
::
mutexes
[
n
]);
pthread_mutex_unlock
(
&
Dep
OpenSSL
::
mutexes
[
n
]);
}
CRYPTO_dynlock_value
*
OpenSSL
::
DynCreateFunction
(
const
char
*
file
,
int
line
)
CRYPTO_dynlock_value
*
Dep
OpenSSL
::
DynCreateFunction
(
const
char
*
file
,
int
line
)
{
// MS_TRACE();
...
...
@@ -132,7 +130,7 @@ CRYPTO_dynlock_value* OpenSSL::DynCreateFunction(const char* file, int line)
return
value
;
}
void
OpenSSL
::
DynLockFunction
(
int
mode
,
CRYPTO_dynlock_value
*
v
,
const
char
*
file
,
int
line
)
void
Dep
OpenSSL
::
DynLockFunction
(
int
mode
,
CRYPTO_dynlock_value
*
v
,
const
char
*
file
,
int
line
)
{
// MS_TRACE();
...
...
@@ -142,7 +140,7 @@ void OpenSSL::DynLockFunction(int mode, CRYPTO_dynlock_value* v, const char* fil
pthread_mutex_unlock
(
&
v
->
mutex
);
}
void
OpenSSL
::
DynDestroyFunction
(
CRYPTO_dynlock_value
*
v
,
const
char
*
file
,
int
line
)
void
Dep
OpenSSL
::
DynDestroyFunction
(
CRYPTO_dynlock_value
*
v
,
const
char
*
file
,
int
line
)
{
// MS_TRACE();
...
...
src/DepUsrSCTP.cpp
0 → 100644
浏览文件 @
eb1115e9
#define MS_CLASS "DepUsrSCTP"
#include "DepUsrSCTP.h"
#include "Logger.h"
#include <usrsctp.h>
/* Static methods. */
void
DepUsrSCTP
::
ClassInit
()
{
MS_TRACE
();
// Initialize usrsctp.
// TODO: second argment must be a function to get outgoing SCTP data
// (to be sent on top of DTLS)
usrsctp_init
(
0
,
nullptr
,
nullptr
);
}
void
DepUsrSCTP
::
ClassDestroy
()
{
MS_TRACE
();
int
err
;
// Free usrsctp.
err
=
usrsctp_finish
();
if
(
err
)
MS_CRIT
(
"usrsctp_finish() failed"
);
}
src/Dispatcher.cpp
浏览文件 @
eb1115e9
...
...
@@ -5,7 +5,7 @@
#include "Daemon.h"
#include "Worker.h"
#include "Utils.h"
#include "LibUV.h"
#include "
Dep
LibUV.h"
#include "ControlProtocol/messages.h"
#include "MediaSoupError.h"
#include "Logger.h"
...
...
@@ -86,7 +86,7 @@ Dispatcher::Dispatcher()
Daemon
::
SendOKStatusToAncestor
();
// Run the loop.
LibUV
::
RunLoop
();
Dep
LibUV
::
RunLoop
();
MS_DEBUG
(
"libuv loop ends"
);
}
...
...
src/MediaSoup.cpp
浏览文件 @
eb1115e9
...
...
@@ -5,9 +5,10 @@
#include "Daemon.h"
#include "Dispatcher.h"
#include "Worker.h"
#include "LibUV.h"
#include "OpenSSL.h"
#include "LibSRTP.h"
#include "DepLibUV.h"
#include "DepOpenSSL.h"
#include "DepLibSRTP.h"
#include "DepUsrSCTP.h"
#include "Utils.h"
#include "RTC/UDPSocket.h"
#include "RTC/TCPServer.h"
...
...
@@ -358,7 +359,7 @@ void MediaSoup::ThreadInit()
Logger
::
ThreadInit
(
"main"
);
// Load libuv stuff.
LibUV
::
ThreadInit
();
Dep
LibUV
::
ThreadInit
();
// Load the crypto utils.
Utils
::
Crypto
::
ThreadInit
();
...
...
@@ -368,7 +369,7 @@ void MediaSoup::ThreadDestroy()
{
MS_TRACE
();
LibUV
::
ThreadDestroy
();
Dep
LibUV
::
ThreadDestroy
();
Utils
::
Crypto
::
ThreadDestroy
();
}
...
...
@@ -378,9 +379,10 @@ void MediaSoup::ClassInit()
MS_TRACE
();
// Initialize static stuff.
LibUV
::
ClassInit
();
OpenSSL
::
ClassInit
();
LibSRTP
::
ClassInit
();
DepLibUV
::
ClassInit
();
DepOpenSSL
::
ClassInit
();
DepLibSRTP
::
ClassInit
();
DepUsrSCTP
::
ClassInit
();
RTC
::
UDPSocket
::
ClassInit
();
RTC
::
TCPServer
::
ClassInit
();
RTC
::
DTLSHandler
::
ClassInit
();
...
...
@@ -393,8 +395,9 @@ void MediaSoup::ClassDestroy()
// Free static stuff.
RTC
::
DTLSHandler
::
ClassDestroy
();
OpenSSL
::
ClassDestroy
();
LibSRTP
::
ClassDestroy
();
DepOpenSSL
::
ClassDestroy
();
DepLibSRTP
::
ClassDestroy
();
DepUsrSCTP
::
ClassDestroy
();
}
/* This method is called within a new thread and creates a Worker. */
...
...
src/RTC/SRTPSession.cpp
浏览文件 @
eb1115e9
...
...
@@ -23,9 +23,9 @@ namespace RTC
err_status_t
err
;
err
=
srtp_install_event_handler
((
srtp_event_handler_func_t
*
)
onSRTPEvent
);
if
(
LibSRTP
::
IsError
(
err
))
if
(
Dep
LibSRTP
::
IsError
(
err
))
{
MS_THROW_ERROR
(
"srtp_install_event_handler() failed: %s"
,
LibSRTP
::
GetErrorString
(
err
));
MS_THROW_ERROR
(
"srtp_install_event_handler() failed: %s"
,
Dep
LibSRTP
::
GetErrorString
(
err
));
}
}
...
...
@@ -101,9 +101,9 @@ namespace RTC
// Set the SRTP session.
err
=
srtp_create
(
&
this
->
session
,
&
policy
);
if
(
LibSRTP
::
IsError
(
err
))
if
(
Dep
LibSRTP
::
IsError
(
err
))
{
MS_THROW_ERROR
(
"srtp_create() failed: %s"
,
LibSRTP
::
GetErrorString
(
err
));
MS_THROW_ERROR
(
"srtp_create() failed: %s"
,
Dep
LibSRTP
::
GetErrorString
(
err
));
}
}
...
...
@@ -116,9 +116,9 @@ namespace RTC
err_status_t
err
;
err
=
srtp_dealloc
(
this
->
session
);
if
(
LibSRTP
::
IsError
(
err
))
if
(
Dep
LibSRTP
::
IsError
(
err
))
{
MS_ABORT
(
"srtp_dealloc() failed: %s"
,
LibSRTP
::
GetErrorString
(
err
));
MS_ABORT
(
"srtp_dealloc() failed: %s"
,
Dep
LibSRTP
::
GetErrorString
(
err
));
}
}
}
...
...
@@ -140,9 +140,9 @@ namespace RTC
std
::
memcpy
(
SRTPSession
::
encryptBuffer
,
*
data
,
*
len
);
this
->
lastError
=
srtp_protect
(
this
->
session
,
(
void
*
)
SRTPSession
::
encryptBuffer
,
(
int
*
)
len
);
if
(
LibSRTP
::
IsError
(
this
->
lastError
))
if
(
Dep
LibSRTP
::
IsError
(
this
->
lastError
))
{
MS_DEBUG
(
"srtp_protect() failed: %s"
,
LibSRTP
::
GetErrorString
(
this
->
lastError
));
MS_DEBUG
(
"srtp_protect() failed: %s"
,
Dep
LibSRTP
::
GetErrorString
(
this
->
lastError
));
return
false
;
}
...
...
@@ -157,9 +157,9 @@ namespace RTC
MS_TRACE
();
this
->
lastError
=
srtp_unprotect
(
this
->
session
,
(
void
*
)
data
,
(
int
*
)
len
);
if
(
LibSRTP
::
IsError
(
this
->
lastError
))
if
(
Dep
LibSRTP
::
IsError
(
this
->
lastError
))
{
MS_DEBUG
(
"srtp_unprotect() failed: %s"
,
LibSRTP
::
GetErrorString
(
this
->
lastError
));
MS_DEBUG
(
"srtp_unprotect() failed: %s"
,
Dep
LibSRTP
::
GetErrorString
(
this
->
lastError
));
return
false
;
}
...
...
@@ -181,9 +181,9 @@ namespace RTC
std
::
memcpy
(
SRTPSession
::
encryptBuffer
,
*
data
,
*
len
);
this
->
lastError
=
srtp_protect_rtcp
(
this
->
session
,
(
void
*
)
SRTPSession
::
encryptBuffer
,
(
int
*
)
len
);
if
(
LibSRTP
::
IsError
(
this
->
lastError
))
if
(
Dep
LibSRTP
::
IsError
(
this
->
lastError
))
{
MS_DEBUG
(
"srtp_protect_rtcp() failed: %s"
,
LibSRTP
::
GetErrorString
(
this
->
lastError
));
MS_DEBUG
(
"srtp_protect_rtcp() failed: %s"
,
Dep
LibSRTP
::
GetErrorString
(
this
->
lastError
));
return
false
;
}
...
...
@@ -198,9 +198,9 @@ namespace RTC
MS_TRACE
();
this
->
lastError
=
srtp_unprotect_rtcp
(
this
->
session
,
(
void
*
)
data
,
(
int
*
)
len
);
if
(
LibSRTP
::
IsError
(
this
->
lastError
))
if
(
Dep
LibSRTP
::
IsError
(
this
->
lastError
))
{
MS_DEBUG
(
"srtp_unprotect_rtcp() failed: %s"
,
LibSRTP
::
GetErrorString
(
this
->
lastError
));
MS_DEBUG
(
"srtp_unprotect_rtcp() failed: %s"
,
Dep
LibSRTP
::
GetErrorString
(
this
->
lastError
));
return
false
;
}
...
...
src/RTC/TCPServer.cpp
浏览文件 @
eb1115e9
...
...
@@ -6,7 +6,7 @@
#include "RTC/DTLSHandler.h"
#include "Settings.h"
#include "Utils.h"
#include "LibUV.h"
#include "
Dep
LibUV.h"
#include "MediaSoupError.h"
#include "Logger.h"
#include <string>
...
...
@@ -232,7 +232,7 @@ namespace RTC
uvHandles
[
0
]
=
new
uv_tcp_t
();
err
=
uv_tcp_init
(
LibUV
::
GetLoop
(),
uvHandles
[
0
]);
err
=
uv_tcp_init
(
Dep
LibUV
::
GetLoop
(),
uvHandles
[
0
]);
if
(
err
)
{
delete
uvHandles
[
0
];
...
...
@@ -272,7 +272,7 @@ namespace RTC
{
uvHandles
[
1
]
=
new
uv_tcp_t
();
err
=
uv_tcp_init
(
LibUV
::
GetLoop
(),
uvHandles
[
1
]);
err
=
uv_tcp_init
(
Dep
LibUV
::
GetLoop
(),
uvHandles
[
1
]);
if
(
err
)
{
uv_close
((
uv_handle_t
*
)
uvHandles
[
0
],
(
uv_close_cb
)
on_error_close
);
...
...
src/RTC/UDPSocket.cpp
浏览文件 @
eb1115e9
...
...
@@ -7,7 +7,7 @@
#include "RTC/RTCPPacket.h"
#include "Settings.h"
#include "Utils.h"
#include "LibUV.h"
#include "
Dep
LibUV.h"
#include "MediaSoupError.h"
#include "Logger.h"
#include <string>
...
...
@@ -230,7 +230,7 @@ namespace RTC
uvHandles
[
0
]
=
new
uv_udp_t
();
err
=
uv_udp_init
(
LibUV
::
GetLoop
(),
uvHandles
[
0
]);
err
=
uv_udp_init
(
Dep
LibUV
::
GetLoop
(),
uvHandles
[
0
]);
if
(
err
)
{
delete
uvHandles
[
0
];
...
...
@@ -270,7 +270,7 @@ namespace RTC
{
uvHandles
[
1
]
=
new
uv_udp_t
();
err
=
uv_udp_init
(
LibUV
::
GetLoop
(),
uvHandles
[
1
]);
err
=
uv_udp_init
(
Dep
LibUV
::
GetLoop
(),
uvHandles
[
1
]);
if
(
err
)
{
uv_close
((
uv_handle_t
*
)
uvHandles
[
0
],
(
uv_close_cb
)
on_error_close
);
...
...
src/Worker.cpp
浏览文件 @
eb1115e9
...
...
@@ -2,7 +2,7 @@
#include "Worker.h"
#include "Utils.h"
#include "LibUV.h"
#include "
Dep
LibUV.h"
#include "ControlProtocol/messages.h"
#include "MediaSoupError.h"
#include "Logger.h"
...
...
@@ -23,7 +23,7 @@ void Worker::ThreadInit(int workerId)
Logger
::
ThreadInit
(
"worker #"
+
std
::
to_string
(
workerId
));
MS_TRACE
();
LibUV
::
ThreadInit
();
Dep
LibUV
::
ThreadInit
();
Utils
::
Crypto
::
ThreadInit
();
}
...
...
@@ -32,7 +32,7 @@ void Worker::ThreadDestroy()
{
MS_TRACE
();
LibUV
::
ThreadDestroy
();
Dep
LibUV
::
ThreadDestroy
();
Utils
::
Crypto
::
ThreadDestroy
();
}
...
...
@@ -156,7 +156,7 @@ Worker::Worker(int workerId) :
Worker
::
numWorkersRunning
++
;
// Run the loop.
LibUV
::
RunLoop
();
Dep
LibUV
::
RunLoop
();
MS_DEBUG
(
"libuv loop ends"
);
}
...
...
src/handles/SignalsHandler.cpp
浏览文件 @
eb1115e9
#define MS_CLASS "SignalsHandler"
#include "handles/SignalsHandler.h"
#include "LibUV.h"
#include "
Dep
LibUV.h"
#include "MediaSoupError.h"
#include "Logger.h"
...
...
@@ -36,7 +36,7 @@ void SignalsHandler::AddSignal(int signum, std::string name)
uv_signal_t
*
uvHandle
=
new
uv_signal_t
;
uvHandle
->
data
=
(
void
*
)
this
;
err
=
uv_signal_init
(
LibUV
::
GetLoop
(),
uvHandle
);
err
=
uv_signal_init
(
Dep
LibUV
::
GetLoop
(),
uvHandle
);
if
(
err
)
{
delete
uvHandle
;
...
...
src/handles/TCPConnection.cpp
浏览文件 @
eb1115e9
...
...
@@ -2,7 +2,7 @@
#include "handles/TCPConnection.h"
#include "Utils.h"
#include "LibUV.h"
#include "
Dep
LibUV.h"
#include "MediaSoupError.h"
#include "Logger.h"
#include <cstring> // std::memcpy()
...
...
@@ -85,7 +85,7 @@ void TCPConnection::Setup(Listener* listener, const std::string &localIP, MS_POR
int
err
;
// Set the UV handle.
err
=
uv_tcp_init
(
LibUV
::
GetLoop
(),
this
->
uvHandle
);
err
=
uv_tcp_init
(
Dep
LibUV
::
GetLoop
(),
this
->
uvHandle
);
if
(
err
)
{
delete
this
->
uvHandle
;
...
...
src/handles/TCPServer.cpp
浏览文件 @
eb1115e9
...
...
@@ -2,7 +2,7 @@
#include "handles/TCPServer.h"
#include "Utils.h"
#include "LibUV.h"
#include "
Dep
LibUV.h"
#include "MediaSoupError.h"
#include "Logger.h"
...
...
@@ -45,7 +45,7 @@ TCPServer::TCPServer(const std::string &ip, MS_PORT port, int backlog)
this
->
uvHandle
=
new
uv_tcp_t
;
this
->
uvHandle
->
data
=
(
void
*
)
this
;
err
=
uv_tcp_init
(
LibUV
::
GetLoop
(),
this
->
uvHandle
);
err
=
uv_tcp_init
(
Dep
LibUV
::
GetLoop
(),
this
->
uvHandle
);
if
(
err
)
{
delete
this
->
uvHandle
;
...
...
src/handles/Timer.cpp
浏览文件 @
eb1115e9
...
...
@@ -2,7 +2,7 @@
#include "handles/Timer.h"
#include "MediaSoupError.h"
#include "LibUV.h"
#include "
Dep
LibUV.h"
#include "Logger.h"
/* Static methods for UV callbacks. */
...
...
@@ -31,7 +31,7 @@ Timer::Timer(Listener* listener) :
this
->
uvHandle
=
new
uv_timer_t
;
uvHandle
->
data
=
(
void
*
)
this
;
err
=
uv_timer_init
(
LibUV
::
GetLoop
(),
this
->
uvHandle
);
err
=
uv_timer_init
(
Dep
LibUV
::
GetLoop
(),
this
->
uvHandle
);
if
(
err
)
{
delete
this
->
uvHandle
;
...
...
src/handles/UDPSocket.cpp
浏览文件 @
eb1115e9
...
...
@@ -2,7 +2,7 @@
#include "handles/UDPSocket.h"
#include "Utils.h"
#include "LibUV.h"
#include "
Dep
LibUV.h"
#include "MediaSoupError.h"
#include "Logger.h"
...
...
@@ -71,7 +71,7 @@ UDPSocket::UDPSocket(const std::string &ip, MS_PORT port)
this
->
uvHandle
=
new
uv_udp_t
;
this
->
uvHandle
->
data
=
(
void
*
)
this
;
err
=
uv_udp_init
(
LibUV
::
GetLoop
(),
this
->
uvHandle
);
err
=
uv_udp_init
(
Dep
LibUV
::
GetLoop
(),
this
->
uvHandle
);
if
(
err
)
{
delete
this
->
uvHandle
;
...
...
src/handles/UnixStreamSocket.cpp
浏览文件 @
eb1115e9
#define MS_CLASS "UnixStreamSocket"
#include "handles/UnixStreamSocket.h"
#include "LibUV.h"
#include "
Dep
LibUV.h"
#include "MediaSoupError.h"
#include "Logger.h"
#include <cstring> // std::memcpy()
...
...
@@ -72,7 +72,7 @@ UnixStreamSocket::UnixStreamSocket(int fd, size_t bufferSize) :
this
->
uvHandle
=
new
uv_pipe_t
;
this
->
uvHandle
->
data
=
(
void
*
)
this
;
err
=
uv_pipe_init
(
LibUV
::
GetLoop
(),
this
->
uvHandle
,
0
);
err
=
uv_pipe_init
(
Dep
LibUV
::
GetLoop
(),
this
->
uvHandle
,
0
);
if
(
err
)
{
delete
this
->
uvHandle
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论