Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
55ae05a5
提交
55ae05a5
authored
12月 22, 2015
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
General work...
上级
89d793c7
显示空白字符变更
内嵌
并排
正在显示
16 个修改的文件
包含
87 行增加
和
27 行删除
+87
-27
Room.js
lib/Room.js
+1
-1
Request.h
worker/include/Channel/Request.h
+13
-1
Request.cpp
worker/src/Channel/Request.cpp
+27
-3
UnixStreamSocket.cpp
worker/src/Channel/UnixStreamSocket.cpp
+1
-3
Logger.cpp
worker/src/Logger.cpp
+2
-2
Loop.cpp
worker/src/Loop.cpp
+26
-0
DTLSHandler.cpp
worker/src/RTC/DTLSHandler.cpp
+2
-2
RTCPPacket.cpp
worker/src/RTC/RTCPPacket.cpp
+1
-1
RTPPacket.cpp
worker/src/RTC/RTPPacket.cpp
+1
-1
SRTPSession.cpp
worker/src/RTC/SRTPSession.cpp
+2
-2
STUNMessage.cpp
worker/src/RTC/STUNMessage.cpp
+2
-2
TCPServer.cpp
worker/src/RTC/TCPServer.cpp
+2
-2
Transport.cpp
worker/src/RTC/Transport.cpp
+2
-2
UDPSocket.cpp
worker/src/RTC/UDPSocket.cpp
+2
-2
Settings.cpp
worker/src/Settings.cpp
+2
-2
UDPSocket.cpp
worker/src/handles/UDPSocket.cpp
+1
-1
没有找到文件。
lib/Room.js
浏览文件 @
55ae05a5
...
@@ -29,7 +29,7 @@ class Room extends EventEmitter
...
@@ -29,7 +29,7 @@ class Room extends EventEmitter
reqData
=
options
;
reqData
=
options
;
reqData
.
roomId
=
this
.
_id
;
reqData
.
roomId
=
this
.
_id
;
this
.
_channel
.
request
(
'createRoom'
,
reqData
)
this
.
_channel
.
request
(
'createRoom
_
'
,
reqData
)
.
then
((
data
)
=>
.
then
((
data
)
=>
{
{
logger
.
debug
(
'"createRoom" request succeeded [data:%o]'
,
data
);
logger
.
debug
(
'"createRoom" request succeeded [data:%o]'
,
data
);
...
...
worker/include/Channel/Request.h
浏览文件 @
55ae05a5
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#include "Channel/UnixStreamSocket.h"
#include "Channel/UnixStreamSocket.h"
#include <string>
#include <string>
#include <unordered_map>
#include <json/json.h>
#include <json/json.h>
namespace
Channel
namespace
Channel
...
@@ -12,11 +13,21 @@ namespace Channel
...
@@ -12,11 +13,21 @@ namespace Channel
class
Request
class
Request
{
{
public
:
enum
class
MethodId
{
createRoom
=
1
,
createPeer
};
public
:
public
:
static
Channel
::
Request
*
Factory
(
Channel
::
UnixStreamSocket
*
channel
,
Json
::
Value
&
json
);
static
Channel
::
Request
*
Factory
(
Channel
::
UnixStreamSocket
*
channel
,
Json
::
Value
&
json
);
private
:
static
std
::
unordered_map
<
std
::
string
,
MethodId
>
string2MethodId
;
public
:
public
:
Request
(
Channel
::
UnixStreamSocket
*
channel
,
unsigned
int
id
,
std
::
string
&
method
,
Json
::
Value
&
data
);
Request
(
Channel
::
UnixStreamSocket
*
channel
,
unsigned
int
id
,
std
::
string
&
method
,
MethodId
methodId
,
Json
::
Value
&
data
);
virtual
~
Request
();
virtual
~
Request
();
// void Accept(Json::Value data = Json::Value(Json::nullValue));
// void Accept(Json::Value data = Json::Value(Json::nullValue));
...
@@ -30,6 +41,7 @@ namespace Channel
...
@@ -30,6 +41,7 @@ namespace Channel
Channel
::
UnixStreamSocket
*
channel
=
nullptr
;
Channel
::
UnixStreamSocket
*
channel
=
nullptr
;
unsigned
int
id
;
unsigned
int
id
;
std
::
string
method
;
std
::
string
method
;
MethodId
methodId
;
Json
::
Value
data
;
Json
::
Value
data
;
// Others.
// Others.
bool
replied
=
false
;
bool
replied
=
false
;
...
...
worker/src/Channel/Request.cpp
浏览文件 @
55ae05a5
...
@@ -5,9 +5,19 @@
...
@@ -5,9 +5,19 @@
namespace
Channel
namespace
Channel
{
{
/* Static variables. */
static
Json
::
Value
empty_data
(
Json
::
objectValue
);
static
Json
::
Value
empty_data
(
Json
::
objectValue
);
/* Static methods. */
/* Class variables. */
std
::
unordered_map
<
std
::
string
,
Request
::
MethodId
>
Request
::
string2MethodId
=
{
{
"createRoom"
,
Request
::
MethodId
::
createRoom
},
{
"createPeer"
,
Request
::
MethodId
::
createPeer
}
};
/* Class methods. */
Channel
::
Request
*
Request
::
Factory
(
Channel
::
UnixStreamSocket
*
channel
,
Json
::
Value
&
json
)
Channel
::
Request
*
Request
::
Factory
(
Channel
::
UnixStreamSocket
*
channel
,
Json
::
Value
&
json
)
{
{
...
@@ -15,6 +25,7 @@ namespace Channel
...
@@ -15,6 +25,7 @@ namespace Channel
unsigned
int
id
;
unsigned
int
id
;
std
::
string
method
;
std
::
string
method
;
MethodId
methodId
;
Json
::
Value
data
;
Json
::
Value
data
;
// TODO: TMP
// TODO: TMP
...
@@ -47,20 +58,33 @@ namespace Channel
...
@@ -47,20 +58,33 @@ namespace Channel
return
nullptr
;
return
nullptr
;
}
}
auto
methodIterator
=
Request
::
string2MethodId
.
find
(
method
);
if
(
methodIterator
!=
Request
::
string2MethodId
.
end
())
{
methodId
=
methodIterator
->
second
;
}
else
{
MS_ERROR
(
"unknwon .method '%s'"
,
method
.
c_str
());
return
nullptr
;
}
if
(
json
[
"data"
].
isObject
())
if
(
json
[
"data"
].
isObject
())
data
=
json
[
"data"
];
data
=
json
[
"data"
];
else
else
data
=
Json
::
Value
(
Json
::
objectValue
);
data
=
Json
::
Value
(
Json
::
objectValue
);
return
new
Request
(
channel
,
id
,
method
,
data
);
return
new
Request
(
channel
,
id
,
method
,
methodId
,
data
);
}
}
/* Instance methods. */
/* Instance methods. */
Request
::
Request
(
Channel
::
UnixStreamSocket
*
channel
,
unsigned
int
id
,
std
::
string
&
method
,
Json
::
Value
&
data
)
:
Request
::
Request
(
Channel
::
UnixStreamSocket
*
channel
,
unsigned
int
id
,
std
::
string
&
method
,
MethodId
methodId
,
Json
::
Value
&
data
)
:
channel
(
channel
),
channel
(
channel
),
id
(
id
),
id
(
id
),
method
(
method
),
method
(
method
),
methodId
(
methodId
),
data
(
data
)
data
(
data
)
{
{
MS_TRACE
();
MS_TRACE
();
...
...
worker/src/Channel/UnixStreamSocket.cpp
浏览文件 @
55ae05a5
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
namespace
Channel
namespace
Channel
{
{
/*
Static
variables. */
/*
Class
variables. */
MS_BYTE
UnixStreamSocket
::
writeBuffer
[
MESSAGE_MAX_SIZE
];
MS_BYTE
UnixStreamSocket
::
writeBuffer
[
MESSAGE_MAX_SIZE
];
...
@@ -24,8 +24,6 @@ namespace Channel
...
@@ -24,8 +24,6 @@ namespace Channel
listener
(
listener
)
listener
(
listener
)
{
{
MS_TRACE
();
MS_TRACE
();
MS_ERROR
(
"---- MAX NS: %lu"
,
netstring_buffer_size
(
MESSAGE_MAX_SIZE
));
}
}
UnixStreamSocket
::~
UnixStreamSocket
()
UnixStreamSocket
::~
UnixStreamSocket
()
...
...
worker/src/Logger.cpp
浏览文件 @
55ae05a5
...
@@ -2,12 +2,12 @@
...
@@ -2,12 +2,12 @@
#include "Logger.h"
#include "Logger.h"
/*
Static
variables. */
/*
Class
variables. */
std
::
string
Logger
::
id
;
std
::
string
Logger
::
id
;
int
Logger
::
fd
;
int
Logger
::
fd
;
/*
Static
methods. */
/*
Class
methods. */
void
Logger
::
Init
(
const
std
::
string
id
)
void
Logger
::
Init
(
const
std
::
string
id
)
{
{
...
...
worker/src/Loop.cpp
浏览文件 @
55ae05a5
...
@@ -102,6 +102,32 @@ void Loop::onChannelRequest(Channel::UnixStreamSocket* channel, Channel::Request
...
@@ -102,6 +102,32 @@ void Loop::onChannelRequest(Channel::UnixStreamSocket* channel, Channel::Request
{
{
MS_TRACE
();
MS_TRACE
();
switch
(
request
->
methodId
)
{
case
Channel
:
:
Request
::
MethodId
::
createRoom
:
{
MS_DEBUG
(
"'createRoom' method"
);
break
;
}
case
Channel
:
:
Request
::
MethodId
::
createPeer
:
{
MS_DEBUG
(
"'createPeer' method"
);
break
;
}
default
:
{
MS_ABORT
(
"unexpected methodId"
);
}
}
// TODO: TMP jeje
if
(
request
->
id
<
25000
)
if
(
request
->
id
<
25000
)
{
{
request
->
Accept
();
request
->
Accept
();
...
...
worker/src/RTC/DTLSHandler.cpp
浏览文件 @
55ae05a5
...
@@ -57,7 +57,7 @@ void on_ssl_info(const SSL* ssl, int where, int ret)
...
@@ -57,7 +57,7 @@ void on_ssl_info(const SSL* ssl, int where, int ret)
namespace
RTC
namespace
RTC
{
{
/*
Static
variables. */
/*
Class
variables. */
X509
*
DTLSHandler
::
certificate
=
nullptr
;
X509
*
DTLSHandler
::
certificate
=
nullptr
;
EVP_PKEY
*
DTLSHandler
::
privateKey
=
nullptr
;
EVP_PKEY
*
DTLSHandler
::
privateKey
=
nullptr
;
...
@@ -77,7 +77,7 @@ namespace RTC
...
@@ -77,7 +77,7 @@ namespace RTC
};
};
MS_BYTE
DTLSHandler
::
sslReadBuffer
[
MS_SSL_READ_BUFFER_SIZE
];
MS_BYTE
DTLSHandler
::
sslReadBuffer
[
MS_SSL_READ_BUFFER_SIZE
];
/*
Static
methods. */
/*
Class
methods. */
void
DTLSHandler
::
ClassInit
()
void
DTLSHandler
::
ClassInit
()
{
{
...
...
worker/src/RTC/RTCPPacket.cpp
浏览文件 @
55ae05a5
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
namespace
RTC
namespace
RTC
{
{
/*
Static
methods. */
/*
Class
methods. */
RTCPPacket
*
RTCPPacket
::
Parse
(
const
MS_BYTE
*
data
,
size_t
len
)
RTCPPacket
*
RTCPPacket
::
Parse
(
const
MS_BYTE
*
data
,
size_t
len
)
{
{
...
...
worker/src/RTC/RTPPacket.cpp
浏览文件 @
55ae05a5
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
namespace
RTC
namespace
RTC
{
{
/*
Static
methods. */
/*
Class
methods. */
RTPPacket
*
RTPPacket
::
Parse
(
const
MS_BYTE
*
data
,
size_t
len
)
RTPPacket
*
RTPPacket
::
Parse
(
const
MS_BYTE
*
data
,
size_t
len
)
{
{
...
...
worker/src/RTC/SRTPSession.cpp
浏览文件 @
55ae05a5
...
@@ -10,11 +10,11 @@
...
@@ -10,11 +10,11 @@
namespace
RTC
namespace
RTC
{
{
/*
Static
variables. */
/*
Class
variables. */
MS_BYTE
SRTPSession
::
encryptBuffer
[
MS_ENCRYPT_BUFFER_SIZE
];
MS_BYTE
SRTPSession
::
encryptBuffer
[
MS_ENCRYPT_BUFFER_SIZE
];
/*
Static
methods. */
/*
Class
methods. */
void
SRTPSession
::
ClassInit
()
void
SRTPSession
::
ClassInit
()
{
{
...
...
worker/src/RTC/STUNMessage.cpp
浏览文件 @
55ae05a5
...
@@ -8,11 +8,11 @@
...
@@ -8,11 +8,11 @@
namespace
RTC
namespace
RTC
{
{
/*
Static
variables. */
/*
Class
variables. */
const
MS_BYTE
STUNMessage
::
magicCookie
[]
=
{
0x21
,
0x12
,
0xA4
,
0x42
};
const
MS_BYTE
STUNMessage
::
magicCookie
[]
=
{
0x21
,
0x12
,
0xA4
,
0x42
};
/*
Static
methods. */
/*
Class
methods. */
STUNMessage
*
STUNMessage
::
Parse
(
const
MS_BYTE
*
data
,
size_t
len
)
STUNMessage
*
STUNMessage
::
Parse
(
const
MS_BYTE
*
data
,
size_t
len
)
{
{
...
...
worker/src/RTC/TCPServer.cpp
浏览文件 @
55ae05a5
...
@@ -24,7 +24,7 @@ void on_error_close(uv_handle_t* handle)
...
@@ -24,7 +24,7 @@ void on_error_close(uv_handle_t* handle)
namespace
RTC
namespace
RTC
{
{
/*
Static
variables. */
/*
Class
variables. */
struct
sockaddr_storage
TCPServer
::
sockaddrStorageIPv4
;
struct
sockaddr_storage
TCPServer
::
sockaddrStorageIPv4
;
struct
sockaddr_storage
TCPServer
::
sockaddrStorageIPv6
;
struct
sockaddr_storage
TCPServer
::
sockaddrStorageIPv6
;
...
@@ -33,7 +33,7 @@ namespace RTC
...
@@ -33,7 +33,7 @@ namespace RTC
TCPServer
::
AvailablePorts
TCPServer
::
availableIPv4Ports
;
TCPServer
::
AvailablePorts
TCPServer
::
availableIPv4Ports
;
TCPServer
::
AvailablePorts
TCPServer
::
availableIPv6Ports
;
TCPServer
::
AvailablePorts
TCPServer
::
availableIPv6Ports
;
/*
Static
methods. */
/*
Class
methods. */
void
TCPServer
::
ClassInit
()
void
TCPServer
::
ClassInit
()
{
{
...
...
worker/src/RTC/Transport.cpp
浏览文件 @
55ae05a5
...
@@ -11,11 +11,11 @@
...
@@ -11,11 +11,11 @@
namespace
RTC
namespace
RTC
{
{
/*
Static
variables. */
/*
Class
variables. */
size_t
Transport
::
maxSources
=
8
;
size_t
Transport
::
maxSources
=
8
;
/*
Static
methods. */
/*
Class
methods. */
Transport
*
Transport
::
NewWebRTC
(
Listener
*
listener
)
Transport
*
Transport
::
NewWebRTC
(
Listener
*
listener
)
{
{
...
...
worker/src/RTC/UDPSocket.cpp
浏览文件 @
55ae05a5
...
@@ -24,7 +24,7 @@ void on_error_close(uv_handle_t* handle)
...
@@ -24,7 +24,7 @@ void on_error_close(uv_handle_t* handle)
namespace
RTC
namespace
RTC
{
{
/*
Static
variables. */
/*
Class
variables. */
struct
sockaddr_storage
UDPSocket
::
sockaddrStorageIPv4
;
struct
sockaddr_storage
UDPSocket
::
sockaddrStorageIPv4
;
struct
sockaddr_storage
UDPSocket
::
sockaddrStorageIPv6
;
struct
sockaddr_storage
UDPSocket
::
sockaddrStorageIPv6
;
...
@@ -33,7 +33,7 @@ namespace RTC
...
@@ -33,7 +33,7 @@ namespace RTC
UDPSocket
::
AvailablePorts
UDPSocket
::
availableIPv4Ports
;
UDPSocket
::
AvailablePorts
UDPSocket
::
availableIPv4Ports
;
UDPSocket
::
AvailablePorts
UDPSocket
::
availableIPv6Ports
;
UDPSocket
::
AvailablePorts
UDPSocket
::
availableIPv6Ports
;
/*
Static
methods. */
/*
Class
methods. */
void
UDPSocket
::
ClassInit
()
void
UDPSocket
::
ClassInit
()
{
{
...
...
worker/src/Settings.cpp
浏览文件 @
55ae05a5
...
@@ -21,7 +21,7 @@ extern "C"
...
@@ -21,7 +21,7 @@ extern "C"
static
static
bool
IsBindableIP
(
const
std
::
string
&
ip
,
int
family
,
int
*
_bind_err
);
bool
IsBindableIP
(
const
std
::
string
&
ip
,
int
family
,
int
*
_bind_err
);
/*
Static
variables. */
/*
Class
variables. */
struct
Settings
::
Configuration
Settings
::
configuration
;
struct
Settings
::
Configuration
Settings
::
configuration
;
std
::
map
<
std
::
string
,
unsigned
int
>
Settings
::
string2LogLevel
=
std
::
map
<
std
::
string
,
unsigned
int
>
Settings
::
string2LogLevel
=
...
@@ -37,7 +37,7 @@ std::map<unsigned int, std::string> Settings::logLevel2String =
...
@@ -37,7 +37,7 @@ std::map<unsigned int, std::string> Settings::logLevel2String =
{
MS_LOG_LEVEL_ERROR
,
"error"
}
{
MS_LOG_LEVEL_ERROR
,
"error"
}
};
};
/*
Static
methods. */
/*
Class
methods. */
void
Settings
::
SetConfiguration
(
int
argc
,
char
*
argv
[])
void
Settings
::
SetConfiguration
(
int
argc
,
char
*
argv
[])
{
{
...
...
worker/src/handles/UDPSocket.cpp
浏览文件 @
55ae05a5
...
@@ -55,7 +55,7 @@ void on_error_close(uv_handle_t* handle)
...
@@ -55,7 +55,7 @@ void on_error_close(uv_handle_t* handle)
delete
handle
;
delete
handle
;
}
}
/*
Static
variables. */
/*
Class
variables. */
MS_BYTE
UDPSocket
::
readBuffer
[
MS_READ_BUFFER_SIZE
];
MS_BYTE
UDPSocket
::
readBuffer
[
MS_READ_BUFFER_SIZE
];
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论