Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
248aaa3a
提交
248aaa3a
authored
1月 28, 2017
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
WebRTC refactor in progress.
上级
539e1c31
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
114 行增加
和
24 行删除
+114
-24
Peer.js
lib/Peer.js
+1
-1
mediasoup.js
lib/mediasoup.js
+1
-1
utils.js
lib/utils.js
+2
-2
RTCDictionaries.js
lib/webrtc/RTCDictionaries.js
+1
-13
RTCPeerConnectionPlanB.js
lib/webrtc/RTCPeerConnection/RTCPeerConnectionPlanB.js
+0
-0
common.js
lib/webrtc/RTCPeerConnection/common.js
+96
-0
index.js
lib/webrtc/RTCPeerConnection/index.js
+10
-7
Peer.cpp
worker/src/RTC/Peer.cpp
+3
-0
没有找到文件。
lib/Peer.js
浏览文件 @
248aaa3a
...
...
@@ -239,7 +239,7 @@ class Peer extends EventEmitter
{
logger
.
debug
(
'"peer.setCapabilities" request succeeded'
);
//
Update peer
capabilities.
//
Set peer's effective
capabilities.
this
.
_data
.
capabilities
=
effectiveCapabilities
;
return
effectiveCapabilities
;
...
...
lib/mediasoup.js
浏览文件 @
248aaa3a
...
...
@@ -34,7 +34,7 @@ module.exports =
*
* @return {Server}
*/
Server
:
function
(
options
)
Server
(
options
)
{
logger
.
debug
(
'Server() [options:%o]'
,
options
);
...
...
lib/utils.js
浏览文件 @
248aaa3a
...
...
@@ -13,14 +13,14 @@ const randomNumberGenerator = randomNumber.generator(
module
.
exports
=
{
randomString
:
function
(
length
)
randomString
(
length
)
{
return
randomString
({
numeric
:
false
,
length
:
length
||
8
}).
toLowerCase
();
},
randomNumber
:
randomNumberGenerator
,
cloneObject
:
function
(
obj
)
cloneObject
(
obj
)
{
if
(
!
obj
||
typeof
obj
!==
'object'
||
Array
.
isArray
(
obj
))
return
{};
...
...
lib/webrtc/RTCDictionaries.js
浏览文件 @
248aaa3a
...
...
@@ -2,22 +2,10 @@
module
.
exports
=
{
RTCSdpType
:
{
offer
:
'offer'
,
answer
:
'answer'
},
RTCSignalingState
:
RTCSignalingState
:
{
stable
:
'stable'
,
haveLocalOffer
:
'have-local-offer'
,
haveRemoteOffer
:
'have-remote-offer'
},
RTCRtpTransceiverDirection
:
{
sendrecv
:
'sendrecv'
,
sendonly
:
'sendonly'
,
recvonly
:
'recvonly'
,
inactive
:
'inactive'
}
};
lib/webrtc/RTCPeerConnection/RTCPeerConnectionPlanB.js
浏览文件 @
248aaa3a
差异被折叠。
点击展开。
lib/webrtc/RTCPeerConnection/common.js
0 → 100644
浏览文件 @
248aaa3a
'use strict'
;
const
sdpTransform
=
require
(
'sdp-transform'
);
const
extra
=
require
(
'../../extra'
);
module
.
exports
=
{
descToCapabilities
(
desc
)
{
let
parsed
=
desc
.
parsed
;
// Map of RtpCodecParameters indexed by payload type.
let
mapCodecs
=
new
Map
();
for
(
let
media
of
parsed
.
media
)
{
// Media kind.
let
kind
=
media
.
type
;
for
(
let
rtp
of
media
.
rtp
)
{
// Ignore feature codecs.
switch
(
rtp
.
codec
.
toLowerCase
())
{
case
'rtx'
:
case
'ulpfec'
:
case
'flexfec'
:
case
'red'
:
continue
;
default
:
}
// TODO: This will fail for kind:depth and video/vp8, but who knows?
let
codecMime
=
kind
+
'/'
+
rtp
.
codec
;
let
codec
=
{
kind
:
kind
,
name
:
codecMime
,
payloadType
:
rtp
.
payload
,
clockRate
:
rtp
.
rate
,
rtcpFeedback
:
[],
parameters
:
{}
};
if
(
rtp
.
encoding
>
1
)
codec
.
numChannels
=
rtp
.
encoding
;
mapCodecs
.
set
(
rtp
.
payload
,
codec
);
}
if
(
media
.
fmtp
)
{
for
(
let
fmtp
of
media
.
fmtp
)
{
let
params
=
sdpTransform
.
parseFmtpConfig
(
fmtp
.
config
);
let
codec
=
mapCodecs
.
get
(
fmtp
.
payload
);
if
(
!
codec
)
continue
;
for
(
let
key
in
Object
.
keys
(
params
))
{
let
normalizedKey
=
extra
.
paramFromSDP
(
key
);
codec
.
parameters
[
normalizedKey
]
=
params
[
key
];
}
}
}
if
(
media
.
rtcpFb
)
{
for
(
let
fb
of
media
.
rtcpFb
)
{
let
codec
=
mapCodecs
.
get
(
fb
.
payload
);
if
(
!
codec
)
continue
;
codec
.
rtcpFeedback
.
push
(
{
type
:
fb
.
type
,
parameter
:
fb
.
subtype
});
}
}
let
capabilities
=
{
codecs
:
Array
.
from
(
mapCodecs
.
values
()),
headerExtensions
:
[],
// TODO
fecMechanisms
:
[]
// TODO
};
return
capabilities
;
}
}
};
lib/webrtc/RTCPeerConnection/index.js
浏览文件 @
248aaa3a
...
...
@@ -2,28 +2,31 @@
const
RTCPeerConnectionUnifiedPlan
=
require
(
'./RTCPeerConnectionUnifiedPlan'
);
const
RTCPeerConnectionPlanB
=
require
(
'./RTCPeerConnectionPlanB'
);
const
Peer
=
require
(
'../../Peer'
);
class
RTCPeerConnection
{
/**
* RTCPeerConnection constructor.
* @param {Room} room
* @param {string} peerName
* @param {object} [options]
* RTCPeerConnection constructor.ç
* @param {object} options
* @param {Peer} options.peer - Peer instance.
* @param {object} [options.transportOptions] - Options for Transport.
* @param {boolean} [options.usePlanB] - Use Plan-B rather than Unified-Plan.
* @param {object} [options.bandwidth]
* @param {number} [options.bandwidth.audio] - Maximum bandwidth for audio streams.
* @param {number} [options.bandwidth.video] - Maximum bandwidth for video streams.
*/
constructor
(
room
,
peerName
,
options
)
constructor
(
options
)
{
options
=
options
||
{};
if
(
!
(
options
.
peer
instanceof
Peer
))
throw
new
TypeError
(
'missing/wrong options.peer'
);
if
(
!
options
.
usePlanB
)
return
new
RTCPeerConnectionUnifiedPlan
(
room
,
peerName
,
options
);
return
new
RTCPeerConnectionUnifiedPlan
(
options
);
else
return
new
RTCPeerConnectionPlanB
(
room
,
peerName
,
options
);
return
new
RTCPeerConnectionPlanB
(
options
);
}
}
...
...
worker/src/RTC/Peer.cpp
浏览文件 @
248aaa3a
...
...
@@ -189,6 +189,9 @@ namespace RTC
Json
::
Value
data
=
this
->
capabilities
.
toJson
();
// NOTE: We accept the request *after* calling onPeerCapabilities(). This
// guarantees that the Peer will receive a 'newrtpsender' event for all its
// associated RtpSenders *before* the setCapabilities() Promise resolves.
request
->
Accept
(
data
);
break
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论