Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
78e10be5
提交
78e10be5
authored
1月 04, 2016
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
- Worker: Set local DTLS role as "server" by default.
- Node: Expose local DTLS role in the Transport API.
上级
9ca93b4c
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
37 行增加
和
20 行删除
+37
-20
Transport.js
lib/Transport.js
+5
-7
server.js
tester/server/server.js
+2
-2
Transport.h
worker/include/RTC/Transport.h
+1
-1
Transport.cpp
worker/src/RTC/Transport.cpp
+29
-10
没有找到文件。
lib/Transport.js
浏览文件 @
78e10be5
...
...
@@ -49,9 +49,9 @@ class Transport extends EventEmitter
return
this
.
_data
.
iceLocalCandidates
;
}
get
dtlsLocal
Fingerprint
s
()
get
dtlsLocal
Parameter
s
()
{
return
this
.
_data
.
dtlsLocal
Fingerprint
s
;
return
this
.
_data
.
dtlsLocal
Parameter
s
;
}
/**
...
...
@@ -132,11 +132,9 @@ class Transport extends EventEmitter
{
logger
.
debug
(
'"transport.setRemoteDtlsParameters" request succeeded'
);
// TODO: Handle content of data and append it to this._data.
// TODO: do we want to return data? It is better to document that
// at this point the DTLS related stuff is available via API
return
data
;
// Take the .role field of the response data and append it to our
// this._data.dtlsLocalParameters
this
.
_data
.
dtlsLocalParameters
.
role
=
data
.
role
;
})
.
catch
((
error
)
=>
{
...
...
tester/server/server.js
浏览文件 @
78e10be5
...
...
@@ -147,7 +147,7 @@ app.put('/test-transport', function(req)
am
.
fingerprint
=
{
type
:
'sha-256'
,
hash
:
mediasoup
.
extra
.
dtlsFingerprintToSDP
(
transport
.
dtlsLocal
F
ingerprints
[
'sha-256'
])
hash
:
mediasoup
.
extra
.
dtlsFingerprintToSDP
(
transport
.
dtlsLocal
Parameters
.
f
ingerprints
[
'sha-256'
])
};
// SDP offer is always 'a=setup:actpass'
am
.
setup
=
'passive'
;
...
...
@@ -163,7 +163,7 @@ app.put('/test-transport', function(req)
// Update the transport with the remote DTLS parameters
setTimeout
(()
=>
{
transport
.
s
tart
(
transport
.
s
etRemoteDtlsParameters
(
{
role
:
'client'
,
fingerprint
:
...
...
worker/include/RTC/Transport.h
浏览文件 @
78e10be5
...
...
@@ -125,7 +125,7 @@ namespace RTC
bool
icePairedWithUseCandidate
=
false
;
// Others (DTLS).
bool
remoteDtlsParametersGiven
=
false
;
RTC
::
DTLSTransport
::
Role
dtlsLocalRole
=
RTC
::
DTLSTransport
::
Role
::
AUTO
;
RTC
::
DTLSTransport
::
Role
dtlsLocalRole
=
RTC
::
DTLSTransport
::
Role
::
SERVER
;
};
/* Inline methods. */
...
...
worker/src/RTC/Transport.cpp
浏览文件 @
78e10be5
...
...
@@ -240,7 +240,11 @@ namespace RTC
static
const
Json
::
StaticString
k_iceLocalCandidates
(
"iceLocalCandidates"
);
static
const
Json
::
StaticString
v_RTP
(
"RTP"
);
static
const
Json
::
StaticString
v_RTCP
(
"RTCP"
);
static
const
Json
::
StaticString
k_dtlsLocalFingerprints
(
"dtlsLocalFingerprints"
);
static
const
Json
::
StaticString
k_dtlsLocalParameters
(
"dtlsLocalParameters"
);
static
const
Json
::
StaticString
k_fingerprints
(
"fingerprints"
);
static
const
Json
::
StaticString
k_role
(
"role"
);
static
const
Json
::
StaticString
v_client
(
"client"
);
static
const
Json
::
StaticString
v_server
(
"server"
);
Json
::
Value
data
;
...
...
@@ -261,8 +265,21 @@ namespace RTC
data
[
k_iceLocalCandidates
].
append
(
iceCandidate
.
toJson
());
}
// Add `dtlsLocalFingerprints`.
data
[
k_dtlsLocalFingerprints
]
=
RTC
::
DTLSTransport
::
GetLocalFingerprints
();
// Add `dtlsLocalParameters.fingerprints`.
data
[
k_dtlsLocalParameters
][
k_fingerprints
]
=
RTC
::
DTLSTransport
::
GetLocalFingerprints
();
// Add `dtlsLocalParameters.role`.
switch
(
this
->
dtlsLocalRole
)
{
case
RTC
:
:
DTLSTransport
::
Role
::
CLIENT
:
data
[
k_dtlsLocalParameters
][
k_role
]
=
v_client
;
break
;
case
RTC
:
:
DTLSTransport
::
Role
::
SERVER
:
data
[
k_dtlsLocalParameters
][
k_role
]
=
v_server
;
break
;
default
:
MS_ABORT
(
"invalid local DTLS role"
);
}
return
data
;
}
...
...
@@ -360,6 +377,8 @@ namespace RTC
case
RTC
:
:
DTLSTransport
::
Role
::
SERVER
:
this
->
dtlsLocalRole
=
RTC
::
DTLSTransport
::
Role
::
CLIENT
;
break
;
// If the peer has "auto" role let us become "client" so DTLS
// happens faster.
case
RTC
:
:
DTLSTransport
::
Role
::
AUTO
:
this
->
dtlsLocalRole
=
RTC
::
DTLSTransport
::
Role
::
CLIENT
;
break
;
...
...
@@ -370,19 +389,18 @@ namespace RTC
return
;
}
// TODO: Provide the local DTLS role in the response so the JS can expose it.
Json
::
Value
data
;
switch
(
this
->
dtlsLocalRole
)
{
case
RTC
:
:
DTLSTransport
::
Role
::
CLIENT
:
data
[
"localDtlsRole"
]
=
"client"
;
data
[
k_role
]
=
v_client
;
break
;
case
RTC
:
:
DTLSTransport
::
Role
::
SERVER
:
data
[
"localDtlsRole"
]
=
"server"
;
data
[
k_role
]
=
v_server
;
break
;
default
:
MS_ABORT
(
"
KAKAKAKAKAKA"
);
// TODO jeje
MS_ABORT
(
"
invalid local DTLS role"
);
}
request
->
Accept
(
data
);
...
...
@@ -423,9 +441,7 @@ namespace RTC
switch
(
this
->
dtlsLocalRole
)
{
// If 'client' then wait for the first Binding with USE-CANDIDATE.
// If 'auto' then behave as 'client' since we are always ICE controlled.
case
RTC
:
:
DTLSTransport
::
Role
::
CLIENT
:
case
RTC
:
:
DTLSTransport
::
Role
::
AUTO
:
if
(
this
->
icePairedWithUseCandidate
)
{
MS_DEBUG
(
"running DTLS transport in 'client' role"
);
...
...
@@ -444,8 +460,11 @@ namespace RTC
}
break
;
case
RTC
:
:
DTLSTransport
::
Role
::
AUTO
:
MS_ABORT
(
"local DTLS role cannot be 'auto'"
);
case
RTC
:
:
DTLSTransport
::
Role
::
NONE
:
MS_ABORT
(
"local DTLS role
cannot be none
"
);
MS_ABORT
(
"local DTLS role
not set
"
);
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论