Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
32a8fb48
提交
32a8fb48
authored
1月 10, 2016
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Minor C++ changes.
上级
29f6079a
隐藏空白字符变更
内嵌
并排
正在显示
15 个修改的文件
包含
86 行增加
和
32 行删除
+86
-32
Peer.js
tester/lib/Peer.js
+48
-8
index.js
tester/lib/index.js
+1
-1
server.js
tester/server/server.js
+2
-2
DTLSTransport.h
worker/include/RTC/DTLSTransport.h
+1
-0
RTCPPacket.h
worker/include/RTC/RTCPPacket.h
+2
-2
RTPPacket.h
worker/include/RTC/RTPPacket.h
+4
-4
TCPServer.h
worker/include/RTC/TCPServer.h
+2
-3
Transport.h
worker/include/RTC/Transport.h
+2
-0
UDPSocket.h
worker/include/RTC/UDPSocket.h
+2
-3
common.h
worker/include/common.h
+1
-1
TCPServer.h
worker/include/handles/TCPServer.h
+1
-2
DTLSTransport.cpp
worker/src/RTC/DTLSTransport.cpp
+2
-0
TCPServer.cpp
worker/src/RTC/TCPServer.cpp
+3
-3
Transport.cpp
worker/src/RTC/Transport.cpp
+12
-0
UDPSocket.cpp
worker/src/RTC/UDPSocket.cpp
+3
-3
没有找到文件。
tester/lib/Peer.js
浏览文件 @
32a8fb48
...
@@ -17,6 +17,9 @@ class Peer extends EventEmitter
...
@@ -17,6 +17,9 @@ class Peer extends EventEmitter
this
.
_debugerror
=
debug
(
`mediasoup-tester:ERROR:Peer:
${
username
}
`
);
this
.
_debugerror
=
debug
(
`mediasoup-tester:ERROR:Peer:
${
username
}
`
);
this
.
_debugerror
.
log
=
console
.
error
.
bind
(
console
);
this
.
_debugerror
.
log
=
console
.
error
.
bind
(
console
);
this
.
_connected
=
false
;
this
.
_stream
=
null
;
this
.
_debug
(
'new()'
);
this
.
_debug
(
'new()'
);
// protoo-client instance
// protoo-client instance
...
@@ -25,23 +28,53 @@ class Peer extends EventEmitter
...
@@ -25,23 +28,53 @@ class Peer extends EventEmitter
url
:
`
${
wsUrl
}
/?username=
${
username
}
&uuid=
${
uuid
}
`
url
:
`
${
wsUrl
}
/?username=
${
username
}
&uuid=
${
uuid
}
`
});
});
this
.
_protoo
.
on
(
'online'
,
()
=>
this
.
emit
(
'online'
));
this
.
_protoo
.
on
(
'online'
,
()
=>
{
this
.
_debug
(
'protoo online'
);
this
.
_connected
=
true
;
mayRun
.
call
(
this
);
});
// PeerConnection instance
// PeerConnection instance
this
.
_pc
=
new
rtcninja
.
RTCPeerConnection
({
iceServers
:
[]
});
this
.
_pc
=
new
rtcninja
.
RTCPeerConnection
({
iceServers
:
[]
});
rtcninja
.
getUserMedia
(
{
audio
:
true
,
video
:
false
},
// callback
((
stream
)
=>
{
this
.
_debug
(
'got local stream'
);
this
.
_stream
=
stream
;
mayRun
.
call
(
this
);
}),
// errback
((
error
)
=>
{
throw
new
Error
(
error
);
})
);
function
mayRun
()
{
if
(
this
.
_connected
&&
this
.
_stream
)
{
this
.
_debug
(
'emitting "ready" event'
);
this
.
_pc
.
addStream
(
this
.
_stream
);
this
.
emit
(
'ready'
);
}
}
}
}
close
()
close
()
{
{
this
.
_debug
(
'close()'
);
this
.
_debug
(
'close()'
);
this
.
_protoo
.
close
();
this
.
closeProtoo
();
try
this
.
closePeerConnection
();
{
this
.
_pc
.
close
();
}
catch
(
error
)
{}
}
}
closeProtoo
()
closeProtoo
()
...
@@ -61,6 +94,13 @@ class Peer extends EventEmitter
...
@@ -61,6 +94,13 @@ class Peer extends EventEmitter
}
}
catch
(
error
)
catch
(
error
)
{}
{}
try
{
this
.
_stream
.
getTracks
().
forEach
((
track
)
=>
track
.
stop
());
}
catch
(
error
)
{}
}
}
testTransport
()
testTransport
()
...
...
tester/lib/index.js
浏览文件 @
32a8fb48
...
@@ -41,7 +41,7 @@ function run()
...
@@ -41,7 +41,7 @@ function run()
let
peer
=
new
Peer
(
protooWsUrl
,
username
,
uuid
);
let
peer
=
new
Peer
(
protooWsUrl
,
username
,
uuid
);
// Call the 'test-transport' service
// Call the 'test-transport' service
peer
.
once
(
'
online
'
,
()
=>
peer
.
once
(
'
ready
'
,
()
=>
{
{
peer
.
testTransport
();
peer
.
testTransport
();
});
});
...
...
tester/server/server.js
浏览文件 @
32a8fb48
...
@@ -171,7 +171,7 @@ app.put('/test-transport', function(req)
...
@@ -171,7 +171,7 @@ app.put('/test-transport', function(req)
{
{
let
promise
=
mediaPeer
.
createTransport
(
let
promise
=
mediaPeer
.
createTransport
(
{
{
udp
:
fals
e
,
udp
:
tru
e
,
tcp
:
true
,
tcp
:
true
,
preferIPv4
:
true
,
preferIPv4
:
true
,
preferUdp
:
true
preferUdp
:
true
...
@@ -283,7 +283,7 @@ app.put('/test-transport', function(req)
...
@@ -283,7 +283,7 @@ app.put('/test-transport', function(req)
// Create a promise
// Create a promise
let
promise
=
transport
.
setRemoteDtlsParameters
(
let
promise
=
transport
.
setRemoteDtlsParameters
(
{
{
role
:
'
auto
'
,
// SDP offer MUST always have a=setup:actpass so we can choose whatever we want
role
:
'
client
'
,
// SDP offer MUST always have a=setup:actpass so we can choose whatever we want
fingerprint
:
fingerprint
:
{
{
algorithm
:
remoteFingerprint
.
type
,
algorithm
:
remoteFingerprint
.
type
,
...
...
worker/include/RTC/DTLSTransport.h
浏览文件 @
32a8fb48
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#include <openssl/ssl.h>
#include <openssl/ssl.h>
#include <openssl/bio.h>
#include <openssl/bio.h>
#include <openssl/x509.h>
#include <openssl/x509.h>
#include <openssl/bio.h>
#include <json/json.h>
#include <json/json.h>
namespace
RTC
namespace
RTC
...
...
worker/include/RTC/RTCPPacket.h
浏览文件 @
32a8fb48
...
@@ -9,7 +9,7 @@ namespace RTC
...
@@ -9,7 +9,7 @@ namespace RTC
{
{
public
:
public
:
/* Struct for RTCP common header. */
/* Struct for RTCP common header. */
typedef
struct
CommonHeader
struct
CommonHeader
{
{
#if defined(MS_LITTLE_ENDIAN)
#if defined(MS_LITTLE_ENDIAN)
MS_BYTE
count
:
5
;
MS_BYTE
count
:
5
;
...
@@ -22,7 +22,7 @@ namespace RTC
...
@@ -22,7 +22,7 @@ namespace RTC
#endif
#endif
MS_BYTE
packet_type
:
8
;
MS_BYTE
packet_type
:
8
;
MS_2BYTES
length
:
16
;
MS_2BYTES
length
:
16
;
}
CommonHeader
;
};
public
:
public
:
static
bool
IsRTCP
(
const
MS_BYTE
*
data
,
size_t
len
);
static
bool
IsRTCP
(
const
MS_BYTE
*
data
,
size_t
len
);
...
...
worker/include/RTC/RTPPacket.h
浏览文件 @
32a8fb48
...
@@ -9,7 +9,7 @@ namespace RTC
...
@@ -9,7 +9,7 @@ namespace RTC
{
{
public
:
public
:
/* Struct for RTP header. */
/* Struct for RTP header. */
typedef
struct
Header
struct
Header
{
{
#if defined(MS_LITTLE_ENDIAN)
#if defined(MS_LITTLE_ENDIAN)
MS_BYTE
csrc_count
:
4
;
MS_BYTE
csrc_count
:
4
;
...
@@ -29,15 +29,15 @@ namespace RTC
...
@@ -29,15 +29,15 @@ namespace RTC
MS_2BYTES
sequence_number
;
MS_2BYTES
sequence_number
;
MS_4BYTES
timestamp
;
MS_4BYTES
timestamp
;
MS_4BYTES
ssrc
;
MS_4BYTES
ssrc
;
}
Header
;
};
/* Struct for RTP header extension. */
/* Struct for RTP header extension. */
typedef
struct
ExtensionHeader
struct
ExtensionHeader
{
{
MS_2BYTES
id
;
MS_2BYTES
id
;
MS_2BYTES
length
;
// Size of value in multiples of 4 bytes.
MS_2BYTES
length
;
// Size of value in multiples of 4 bytes.
MS_BYTE
*
value
;
MS_BYTE
*
value
;
}
ExtensionHeader
;
};
public
:
public
:
static
bool
IsRTP
(
const
MS_BYTE
*
data
,
size_t
len
);
static
bool
IsRTP
(
const
MS_BYTE
*
data
,
size_t
len
);
...
...
worker/include/RTC/TCPServer.h
浏览文件 @
32a8fb48
...
@@ -33,9 +33,8 @@ namespace RTC
...
@@ -33,9 +33,8 @@ namespace RTC
static
struct
sockaddr_storage
sockaddrStorageIPv6
;
static
struct
sockaddr_storage
sockaddrStorageIPv6
;
static
MS_PORT
minPort
;
static
MS_PORT
minPort
;
static
MS_PORT
maxPort
;
static
MS_PORT
maxPort
;
typedef
std
::
unordered_map
<
MS_PORT
,
bool
>
AvailablePorts
;
static
std
::
unordered_map
<
MS_PORT
,
bool
>
availableIPv4Ports
;
static
AvailablePorts
availableIPv4Ports
;
static
std
::
unordered_map
<
MS_PORT
,
bool
>
availableIPv6Ports
;
static
AvailablePorts
availableIPv6Ports
;
public
:
public
:
TCPServer
(
Listener
*
listener
,
RTC
::
TCPConnection
::
Reader
*
reader
,
uv_tcp_t
*
uvHandle
);
TCPServer
(
Listener
*
listener
,
RTC
::
TCPConnection
::
Reader
*
reader
,
uv_tcp_t
*
uvHandle
);
...
...
worker/include/RTC/Transport.h
浏览文件 @
32a8fb48
...
@@ -10,6 +10,8 @@
...
@@ -10,6 +10,8 @@
#include "RTC/STUNMessage.h"
#include "RTC/STUNMessage.h"
#include "RTC/TransportTuple.h"
#include "RTC/TransportTuple.h"
#include "RTC/DTLSTransport.h"
#include "RTC/DTLSTransport.h"
#include "RTC/RTPPacket.h"
#include "RTC/RTCPPacket.h"
#include "Channel/Notifier.h"
#include "Channel/Notifier.h"
#include <string>
#include <string>
#include <vector>
#include <vector>
...
...
worker/include/RTC/UDPSocket.h
浏览文件 @
32a8fb48
...
@@ -34,9 +34,8 @@ namespace RTC
...
@@ -34,9 +34,8 @@ namespace RTC
static
struct
sockaddr_storage
sockaddrStorageIPv6
;
static
struct
sockaddr_storage
sockaddrStorageIPv6
;
static
MS_PORT
minPort
;
static
MS_PORT
minPort
;
static
MS_PORT
maxPort
;
static
MS_PORT
maxPort
;
typedef
std
::
unordered_map
<
MS_PORT
,
bool
>
AvailablePorts
;
static
std
::
unordered_map
<
MS_PORT
,
bool
>
availableIPv4Ports
;
static
AvailablePorts
availableIPv4Ports
;
static
std
::
unordered_map
<
MS_PORT
,
bool
>
availableIPv6Ports
;
static
AvailablePorts
availableIPv6Ports
;
public
:
public
:
UDPSocket
(
Listener
*
listener
,
uv_udp_t
*
uvHandle
);
UDPSocket
(
Listener
*
listener
,
uv_udp_t
*
uvHandle
);
...
...
worker/include/common.h
浏览文件 @
32a8fb48
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#define MS_BIG_ENDIAN
#define MS_BIG_ENDIAN
#else
#else
#error "cannot determine whether the
processor
is Little-Endian or Big-Endian"
#error "cannot determine whether the
CPU
is Little-Endian or Big-Endian"
#endif
#endif
#endif
#endif
...
...
worker/include/handles/TCPServer.h
浏览文件 @
32a8fb48
...
@@ -48,8 +48,7 @@ private:
...
@@ -48,8 +48,7 @@ private:
// Allocated by this (may be passed by argument).
// Allocated by this (may be passed by argument).
uv_tcp_t
*
uvHandle
=
nullptr
;
uv_tcp_t
*
uvHandle
=
nullptr
;
// Others.
// Others.
typedef
std
::
unordered_set
<
TCPConnection
*>
TCPConnections
;
std
::
unordered_set
<
TCPConnection
*>
connections
;
TCPConnections
connections
;
bool
isClosing
=
false
;
bool
isClosing
=
false
;
protected
:
protected
:
...
...
worker/src/RTC/DTLSTransport.cpp
浏览文件 @
32a8fb48
...
@@ -847,6 +847,8 @@ namespace RTC
...
@@ -847,6 +847,8 @@ namespace RTC
char
*
data
=
nullptr
;
char
*
data
=
nullptr
;
read
=
BIO_get_mem_data
(
this
->
sslBioToNetwork
,
&
data
);
read
=
BIO_get_mem_data
(
this
->
sslBioToNetwork
,
&
data
);
if
(
read
<=
0
)
return
;
MS_DEBUG
(
"%ld bytes of DTLS data ready to sent to the peer"
,
read
);
MS_DEBUG
(
"%ld bytes of DTLS data ready to sent to the peer"
,
read
);
...
...
worker/src/RTC/TCPServer.cpp
浏览文件 @
32a8fb48
...
@@ -29,8 +29,8 @@ namespace RTC
...
@@ -29,8 +29,8 @@ namespace RTC
struct
sockaddr_storage
TCPServer
::
sockaddrStorageIPv6
;
struct
sockaddr_storage
TCPServer
::
sockaddrStorageIPv6
;
MS_PORT
TCPServer
::
minPort
;
MS_PORT
TCPServer
::
minPort
;
MS_PORT
TCPServer
::
maxPort
;
MS_PORT
TCPServer
::
maxPort
;
TCPServer
::
AvailablePorts
TCPServer
::
availableIPv4Ports
;
std
::
unordered_map
<
MS_PORT
,
bool
>
TCPServer
::
availableIPv4Ports
;
TCPServer
::
AvailablePorts
TCPServer
::
availableIPv6Ports
;
std
::
unordered_map
<
MS_PORT
,
bool
>
TCPServer
::
availableIPv6Ports
;
/* Class methods. */
/* Class methods. */
...
@@ -112,7 +112,7 @@ namespace RTC
...
@@ -112,7 +112,7 @@ namespace RTC
uint16_t
attempt
=
0
;
uint16_t
attempt
=
0
;
uint16_t
bindAttempt
=
0
;
uint16_t
bindAttempt
=
0
;
int
flags
=
0
;
int
flags
=
0
;
AvailablePorts
*
available_ports
;
std
::
unordered_map
<
MS_PORT
,
bool
>
*
available_ports
;
switch
(
address_family
)
switch
(
address_family
)
{
{
...
...
worker/src/RTC/Transport.cpp
浏览文件 @
32a8fb48
...
@@ -647,6 +647,17 @@ namespace RTC
...
@@ -647,6 +647,17 @@ namespace RTC
this
->
iceServer
->
ForceSelectedTuple
(
tuple
);
this
->
iceServer
->
ForceSelectedTuple
(
tuple
);
// TODO
// TODO
MS_DEBUG
(
"received RTP data"
);
RTC
::
RTPPacket
*
packet
=
RTC
::
RTPPacket
::
Parse
(
data
,
len
);
if
(
!
packet
)
{
MS_DEBUG
(
"data received is not a valid RTP packet"
);
return
;
}
packet
->
Dump
();
delete
packet
;
}
}
inline
inline
...
@@ -665,6 +676,7 @@ namespace RTC
...
@@ -665,6 +676,7 @@ namespace RTC
this
->
iceServer
->
ForceSelectedTuple
(
tuple
);
this
->
iceServer
->
ForceSelectedTuple
(
tuple
);
// TODO
// TODO
MS_DEBUG
(
"received RTCP data"
);
}
}
void
Transport
::
onSTUNDataRecv
(
RTC
::
UDPSocket
*
socket
,
const
MS_BYTE
*
data
,
size_t
len
,
const
struct
sockaddr
*
remote_addr
)
void
Transport
::
onSTUNDataRecv
(
RTC
::
UDPSocket
*
socket
,
const
MS_BYTE
*
data
,
size_t
len
,
const
struct
sockaddr
*
remote_addr
)
...
...
worker/src/RTC/UDPSocket.cpp
浏览文件 @
32a8fb48
...
@@ -30,8 +30,8 @@ namespace RTC
...
@@ -30,8 +30,8 @@ namespace RTC
struct
sockaddr_storage
UDPSocket
::
sockaddrStorageIPv6
;
struct
sockaddr_storage
UDPSocket
::
sockaddrStorageIPv6
;
MS_PORT
UDPSocket
::
minPort
;
MS_PORT
UDPSocket
::
minPort
;
MS_PORT
UDPSocket
::
maxPort
;
MS_PORT
UDPSocket
::
maxPort
;
UDPSocket
::
AvailablePorts
UDPSocket
::
availableIPv4Ports
;
std
::
unordered_map
<
MS_PORT
,
bool
>
UDPSocket
::
availableIPv4Ports
;
UDPSocket
::
AvailablePorts
UDPSocket
::
availableIPv6Ports
;
std
::
unordered_map
<
MS_PORT
,
bool
>
UDPSocket
::
availableIPv6Ports
;
/* Class methods. */
/* Class methods. */
...
@@ -113,7 +113,7 @@ namespace RTC
...
@@ -113,7 +113,7 @@ namespace RTC
uint16_t
attempt
=
0
;
uint16_t
attempt
=
0
;
uint16_t
bindAttempt
=
0
;
uint16_t
bindAttempt
=
0
;
int
flags
=
0
;
int
flags
=
0
;
AvailablePorts
*
available_ports
;
std
::
unordered_map
<
MS_PORT
,
bool
>
*
available_ports
;
switch
(
address_family
)
switch
(
address_family
)
{
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论