Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
e51c3af8
提交
e51c3af8
authored
1月 11, 2020
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ortc.ts: Add functions to validate RTP/SCTP parameters
上级
7971dcd0
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
16 个修改的文件
包含
236 行增加
和
116 行删除
+236
-116
Transport.d.ts.map
lib/Transport.d.ts.map
+2
-2
Transport.js
lib/Transport.js
+11
-8
ortc.d.ts
lib/ortc.d.ts
+81
-2
ortc.d.ts.map
lib/ortc.d.ts.map
+2
-2
ortc.js
lib/ortc.js
+0
-0
supportedRtpCapabilities.d.ts.map
lib/supportedRtpCapabilities.d.ts.map
+2
-2
supportedRtpCapabilities.js
lib/supportedRtpCapabilities.js
+1
-2
Transport.ts
src/Transport.ts
+17
-8
ortc.ts
src/ortc.ts
+0
-0
supportedRtpCapabilities.ts
src/supportedRtpCapabilities.ts
+1
-2
test-Consumer.js
test/test-Consumer.js
+25
-24
test-PipeTransport.js
test/test-PipeTransport.js
+76
-45
test-PlainRtpTransport.js
test/test-PlainRtpTransport.js
+6
-6
test-Producer.js
test/test-Producer.js
+6
-6
test-Router.js
test/test-Router.js
+6
-7
test-ortc.js
test/test-ortc.js
+0
-0
没有找到文件。
lib/Transport.d.ts.map
浏览文件 @
e51c3af8
{"version":3,"file":"Transport.d.ts","sourceRoot":"","sources":["../src/Transport.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;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O,CAAC,QAAQ,CAAC;IA2DpB;;OAEG;IACG,WAAW,CAChB,EACC,EAAc,EACd,oBAAoB,EACpB,KAAU,EACV,QAAa,EACb,OAAY,EACZ,EAAE,mBAAmB,GACpB,OAAO,CAAC,YAAY,CAAC;IAyCxB;;OAEG;IACG,WAAW,CAChB,EACC,cAAc,EACd,OAAY,EACZ,EAAE,mBAAmB,GACpB,OAAO,CAAC,YAAY,CAAC;IA2DxB;;OAEG;IACG,gBAAgB,CAAC,KAAK,GAAE,uBAAuB,EAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAU5E,OAAO,CAAC,oBAAoB;CA+B5B"}
\ No newline at end of file
\ No newline at end of file
lib/Transport.js
浏览文件 @
e51c3af8
...
@@ -234,13 +234,16 @@ class Transport extends EnhancedEventEmitter_1.EnhancedEventEmitter {
...
@@ -234,13 +234,16 @@ class Transport extends EnhancedEventEmitter_1.EnhancedEventEmitter {
throw
new
TypeError
(
`a Producer with same id "
${
id
}
" already exists`
);
throw
new
TypeError
(
`a Producer with same id "
${
id
}
" already exists`
);
else
if
(
!
[
'audio'
,
'video'
].
includes
(
kind
))
else
if
(
!
[
'audio'
,
'video'
].
includes
(
kind
))
throw
new
TypeError
(
`invalid kind "
${
kind
}
"`
);
throw
new
TypeError
(
`invalid kind "
${
kind
}
"`
);
else
if
(
typeof
rtpParameters
!==
'object'
)
throw
new
TypeError
(
'missing rtpParameters'
);
else
if
(
appData
&&
typeof
appData
!==
'object'
)
else
if
(
appData
&&
typeof
appData
!==
'object'
)
throw
new
TypeError
(
'if given, appData must be an object'
);
throw
new
TypeError
(
'if given, appData must be an object'
);
// If missing encodings, add one.
// This may throw.
if
(
!
rtpParameters
.
encodings
||
!
Array
.
isArray
(
rtpParameters
.
encodings
))
ortc
.
validateRtpParameters
(
rtpParameters
);
// If missing or empty encodings, add one.
if
(
!
rtpParameters
.
encodings
||
!
Array
.
isArray
(
rtpParameters
.
encodings
)
||
rtpParameters
.
encodings
.
length
===
0
)
{
rtpParameters
.
encodings
=
[{}];
rtpParameters
.
encodings
=
[{}];
}
// Don't do this in PipeTransports since there we must keep CNAME value in
// Don't do this in PipeTransports since there we must keep CNAME value in
// each Producer.
// each Producer.
if
(
this
.
constructor
.
name
!==
'PipeTransport'
)
{
if
(
this
.
constructor
.
name
!==
'PipeTransport'
)
{
...
@@ -300,10 +303,10 @@ class Transport extends EnhancedEventEmitter_1.EnhancedEventEmitter {
...
@@ -300,10 +303,10 @@ class Transport extends EnhancedEventEmitter_1.EnhancedEventEmitter {
logger
.
debug
(
'consume()'
);
logger
.
debug
(
'consume()'
);
if
(
!
producerId
||
typeof
producerId
!==
'string'
)
if
(
!
producerId
||
typeof
producerId
!==
'string'
)
throw
new
TypeError
(
'missing producerId'
);
throw
new
TypeError
(
'missing producerId'
);
else
if
(
typeof
rtpCapabilities
!==
'object'
)
throw
new
TypeError
(
'missing rtpCapabilities'
);
else
if
(
appData
&&
typeof
appData
!==
'object'
)
else
if
(
appData
&&
typeof
appData
!==
'object'
)
throw
new
TypeError
(
'if given, appData must be an object'
);
throw
new
TypeError
(
'if given, appData must be an object'
);
// This may throw.
ortc
.
validateRtpCapabilities
(
rtpCapabilities
);
const
producer
=
this
.
_getProducerById
(
producerId
);
const
producer
=
this
.
_getProducerById
(
producerId
);
if
(
!
producer
)
if
(
!
producer
)
throw
Error
(
`Producer with id "
${
producerId
}
" not found`
);
throw
Error
(
`Producer with id "
${
producerId
}
" not found`
);
...
@@ -346,10 +349,10 @@ class Transport extends EnhancedEventEmitter_1.EnhancedEventEmitter {
...
@@ -346,10 +349,10 @@ class Transport extends EnhancedEventEmitter_1.EnhancedEventEmitter {
logger
.
debug
(
'produceData()'
);
logger
.
debug
(
'produceData()'
);
if
(
id
&&
this
.
_dataProducers
.
has
(
id
))
if
(
id
&&
this
.
_dataProducers
.
has
(
id
))
throw
new
TypeError
(
`a DataProducer with same id "
${
id
}
" already exists`
);
throw
new
TypeError
(
`a DataProducer with same id "
${
id
}
" already exists`
);
else
if
(
typeof
sctpStreamParameters
!==
'object'
)
throw
new
TypeError
(
'missing sctpStreamParameters'
);
else
if
(
appData
&&
typeof
appData
!==
'object'
)
else
if
(
appData
&&
typeof
appData
!==
'object'
)
throw
new
TypeError
(
'if given, appData must be an object'
);
throw
new
TypeError
(
'if given, appData must be an object'
);
// This may throw.
ortc
.
validateSctpStreamParameters
(
sctpStreamParameters
);
const
internal
=
Object
.
assign
(
Object
.
assign
({},
this
.
_internal
),
{
dataProducerId
:
id
||
v4_1
.
default
()
});
const
internal
=
Object
.
assign
(
Object
.
assign
({},
this
.
_internal
),
{
dataProducerId
:
id
||
v4_1
.
default
()
});
const
reqData
=
{
sctpStreamParameters
,
label
,
protocol
};
const
reqData
=
{
sctpStreamParameters
,
label
,
protocol
};
const
data
=
yield
this
.
_channel
.
request
(
'transport.produceData'
,
internal
,
reqData
);
const
data
=
yield
this
.
_channel
.
request
(
'transport.produceData'
,
internal
,
reqData
);
...
...
lib/ortc.d.ts
浏览文件 @
e51c3af8
import
{
RtpCapabilities
,
RtpCodecCapability
,
RtpParameters
}
from
'./RtpParameters'
;
import
{
RtpCapabilities
,
RtpCodecCapability
,
RtpHeaderExtension
,
RtpParameters
,
RtpCodecParameters
,
RtcpFeedback
,
RtpEncodingParameters
,
RtpHeaderExtensionParameters
,
RtcpParameters
}
from
'./RtpParameters'
;
import
{
SctpCapabilities
,
NumSctpStreams
,
SctpParameters
,
SctpStreamParameters
}
from
'./SctpParameters'
;
interface
RtpMapping
{
interface
RtpMapping
{
codecs
:
{
codecs
:
{
payloadType
:
number
;
payloadType
:
number
;
...
@@ -11,11 +12,89 @@ interface RtpMapping {
...
@@ -11,11 +12,89 @@ interface RtpMapping {
mappedSsrc
:
number
;
mappedSsrc
:
number
;
}[];
}[];
}
}
/**
* Validates RtpCapabilities. It may modify given data by adding missing
* fields with default values.
* It throws if invalid.
*/
export
declare
function
validateRtpCapabilities
(
caps
:
RtpCapabilities
):
void
;
/**
* Validates RtpCodecCapability. It may modify given data by adding missing
* fields with default values.
* It throws if invalid.
*/
export
declare
function
validateRtpCodecCapability
(
codec
:
RtpCodecCapability
):
void
;
/**
* Validates RtcpFeedback. It may modify given data by adding missing
* fields with default values.
* It throws if invalid.
*/
export
declare
function
validateRtcpFeedback
(
fb
:
RtcpFeedback
):
void
;
/**
* Validates RtpHeaderExtension. It may modify given data by adding missing
* fields with default values.
* It throws if invalid.
*/
export
declare
function
validateRtpHeaderExtension
(
ext
:
RtpHeaderExtension
):
void
;
/**
* Validates RtpParameters. It may modify given data by adding missing
* fields with default values.
* It throws if invalid.
*/
export
declare
function
validateRtpParameters
(
params
:
RtpParameters
):
void
;
/**
* Validates RtpCodecParameters. It may modify given data by adding missing
* fields with default values.
* It throws if invalid.
*/
export
declare
function
validateRtpCodecParameters
(
codec
:
RtpCodecParameters
):
void
;
/**
* Validates RtpHeaderExtensionParameteters. It may modify given data by adding missing
* fields with default values.
* It throws if invalid.
*/
export
declare
function
validateRtpHeaderExtensionParameters
(
ext
:
RtpHeaderExtensionParameters
):
void
;
/**
* Validates RtpEncodingParameters. It may modify given data by adding missing
* fields with default values.
* It throws if invalid.
*/
export
declare
function
validateRtpEncodingParameters
(
encoding
:
RtpEncodingParameters
):
void
;
/**
* Validates RtcpParameters. It may modify given data by adding missing
* fields with default values.
* It throws if invalid.
*/
export
declare
function
validateRtcpParameters
(
rtcp
:
RtcpParameters
):
void
;
/**
* Validates SctpCapabilities. It may modify given data by adding missing
* fields with default values.
* It throws if invalid.
*/
export
declare
function
validateSctpCapabilities
(
caps
:
SctpCapabilities
):
void
;
/**
* Validates NumSctpStreams. It may modify given data by adding missing
* fields with default values.
* It throws if invalid.
*/
export
declare
function
validateNumSctpStreams
(
numStreams
:
NumSctpStreams
):
void
;
/**
* Validates SctpParameters. It may modify given data by adding missing
* fields with default values.
* It throws if invalid.
*/
export
declare
function
validateSctpParameters
(
params
:
SctpParameters
):
void
;
/**
* Validates SctpStreamParameters. It may modify given data by adding missing
* fields with default values.
* It throws if invalid.
*/
export
declare
function
validateSctpStreamParameters
(
params
:
SctpStreamParameters
):
void
;
/**
/**
* Generate RTP capabilities for the Router based on the given media codecs and
* Generate RTP capabilities for the Router based on the given media codecs and
* mediasoup supported RTP capabilities.
* mediasoup supported RTP capabilities.
*/
*/
export
declare
function
generateRouterRtpCapabilities
(
mediaCodecs
?:
RtpCodecCapability
[]):
R
TCR
tpCapabilities
;
export
declare
function
generateRouterRtpCapabilities
(
mediaCodecs
?:
RtpCodecCapability
[]):
RtpCapabilities
;
/**
/**
* Get a mapping of codec payloads and encodings of the given Producer RTP
* Get a mapping of codec payloads and encodings of the given Producer RTP
* parameters as values expected by the Router.
* parameters as values expected by the Router.
...
...
lib/ortc.d.ts.map
浏览文件 @
e51c3af8
{"version":3,"file":"ortc.d.ts","sourceRoot":"","sources":["../src/ortc.ts"],"names":[],"mappings":"AAKA,OAAO,EAEN,eAAe,EACf,kBAAkB,EAClB,aAAa,EAIb,MAAM,iBAAiB,CAAC;AAEzB,UAAU,UAAU;IAEnB,MAAM,EACN;QACC,WAAW,EAAE,MAAM,CAAC;QACpB,iBAAiB,EAAE,MAAM,CAAC;KAC1B,EAAE,CAAC;IAEJ,SAAS,EACT;QACC,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,UAAU,EAAE,MAAM,CAAC;KACnB,EAAE,CAAC;CACJ;AASD;;;GAGG;AACH,wBAAgB,6BAA6B,CAC5C,WAAW,GAAE,kBAAkB,EAAO,GACpC,kBAAkB,CA2GpB;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAC9C,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,eAAe,GACnB,UAAU,CAmGZ;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACzC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,eAAe,EACrB,UAAU,EAAE,UAA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AgB,wBAAwB,CACvC,gBAAgB,EAAE,aAAa,EAC/B,IAAI,EAAE,eAAe,GACnB,aAAa,CAwHf;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC3C,gBAAgB,EAAE,aAAa,GAC7B,aAAa,CAgDf"}
\ No newline at end of file
\ No newline at end of file
lib/ortc.js
浏览文件 @
e51c3af8
差异被折叠。
点击展开。
lib/supportedRtpCapabilities.d.ts.map
浏览文件 @
e51c3af8
{"version":3,"file":"supportedRtpCapabilities.d.ts","sourceRoot":"","sources":["../src/supportedRtpCapabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,QAAA,MAAM,wBAAwB,EAAE,eAsV/B,CAAC;AAEF,OAAO,EAAE,wBAAwB,EAAE,CAAC"}
{"version":3,"file":"supportedRtpCapabilities.d.ts","sourceRoot":"","sources":["../src/supportedRtpCapabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,QAAA,MAAM,wBAAwB,EAAE,eAqV/B,CAAC;AAEF,OAAO,EAAE,wBAAwB,EAAE,CAAC"}
\ No newline at end of file
\ No newline at end of file
lib/supportedRtpCapabilities.js
浏览文件 @
e51c3af8
...
@@ -315,7 +315,6 @@ const supportedRtpCapabilities = {
...
@@ -315,7 +315,6 @@ const supportedRtpCapabilities = {
preferredEncrypt
:
false
,
preferredEncrypt
:
false
,
direction
:
'sendrecv'
direction
:
'sendrecv'
}
}
],
]
fecMechanisms
:
[]
};
};
exports
.
supportedRtpCapabilities
=
supportedRtpCapabilities
;
exports
.
supportedRtpCapabilities
=
supportedRtpCapabilities
;
src/Transport.ts
浏览文件 @
e51c3af8
...
@@ -397,14 +397,21 @@ export class Transport extends EnhancedEventEmitter
...
@@ -397,14 +397,21 @@ export class Transport extends EnhancedEventEmitter
throw
new
TypeError
(
`a Producer with same id "
${
id
}
" already exists`
);
throw
new
TypeError
(
`a Producer with same id "
${
id
}
" already exists`
);
else
if
(
!
[
'audio'
,
'video'
].
includes
(
kind
))
else
if
(
!
[
'audio'
,
'video'
].
includes
(
kind
))
throw
new
TypeError
(
`invalid kind "
${
kind
}
"`
);
throw
new
TypeError
(
`invalid kind "
${
kind
}
"`
);
else
if
(
typeof
rtpParameters
!==
'object'
)
throw
new
TypeError
(
'missing rtpParameters'
);
else
if
(
appData
&&
typeof
appData
!==
'object'
)
else
if
(
appData
&&
typeof
appData
!==
'object'
)
throw
new
TypeError
(
'if given, appData must be an object'
);
throw
new
TypeError
(
'if given, appData must be an object'
);
// If missing encodings, add one.
// This may throw.
if
(
!
rtpParameters
.
encodings
||
!
Array
.
isArray
(
rtpParameters
.
encodings
))
ortc
.
validateRtpParameters
(
rtpParameters
);
// If missing or empty encodings, add one.
if
(
!
rtpParameters
.
encodings
||
!
Array
.
isArray
(
rtpParameters
.
encodings
)
||
rtpParameters
.
encodings
.
length
===
0
)
{
rtpParameters
.
encodings
=
[
{}
];
rtpParameters
.
encodings
=
[
{}
];
}
// Don't do this in PipeTransports since there we must keep CNAME value in
// Don't do this in PipeTransports since there we must keep CNAME value in
// each Producer.
// each Producer.
...
@@ -495,11 +502,12 @@ export class Transport extends EnhancedEventEmitter
...
@@ -495,11 +502,12 @@ export class Transport extends EnhancedEventEmitter
if
(
!
producerId
||
typeof
producerId
!==
'string'
)
if
(
!
producerId
||
typeof
producerId
!==
'string'
)
throw
new
TypeError
(
'missing producerId'
);
throw
new
TypeError
(
'missing producerId'
);
else
if
(
typeof
rtpCapabilities
!==
'object'
)
throw
new
TypeError
(
'missing rtpCapabilities'
);
else
if
(
appData
&&
typeof
appData
!==
'object'
)
else
if
(
appData
&&
typeof
appData
!==
'object'
)
throw
new
TypeError
(
'if given, appData must be an object'
);
throw
new
TypeError
(
'if given, appData must be an object'
);
// This may throw.
ortc
.
validateRtpCapabilities
(
rtpCapabilities
);
const
producer
=
this
.
_getProducerById
(
producerId
);
const
producer
=
this
.
_getProducerById
(
producerId
);
if
(
!
producer
)
if
(
!
producer
)
...
@@ -564,11 +572,12 @@ export class Transport extends EnhancedEventEmitter
...
@@ -564,11 +572,12 @@ export class Transport extends EnhancedEventEmitter
if
(
id
&&
this
.
_dataProducers
.
has
(
id
))
if
(
id
&&
this
.
_dataProducers
.
has
(
id
))
throw
new
TypeError
(
`a DataProducer with same id "
${
id
}
" already exists`
);
throw
new
TypeError
(
`a DataProducer with same id "
${
id
}
" already exists`
);
else
if
(
typeof
sctpStreamParameters
!==
'object'
)
throw
new
TypeError
(
'missing sctpStreamParameters'
);
else
if
(
appData
&&
typeof
appData
!==
'object'
)
else
if
(
appData
&&
typeof
appData
!==
'object'
)
throw
new
TypeError
(
'if given, appData must be an object'
);
throw
new
TypeError
(
'if given, appData must be an object'
);
// This may throw.
ortc
.
validateSctpStreamParameters
(
sctpStreamParameters
);
const
internal
=
{
...
this
.
_internal
,
dataProducerId
:
id
||
uuidv4
()
};
const
internal
=
{
...
this
.
_internal
,
dataProducerId
:
id
||
uuidv4
()
};
const
reqData
=
{
sctpStreamParameters
,
label
,
protocol
};
const
reqData
=
{
sctpStreamParameters
,
label
,
protocol
};
...
...
src/ortc.ts
浏览文件 @
e51c3af8
差异被折叠。
点击展开。
src/supportedRtpCapabilities.ts
浏览文件 @
e51c3af8
...
@@ -340,8 +340,7 @@ const supportedRtpCapabilities: RtpCapabilities =
...
@@ -340,8 +340,7 @@ const supportedRtpCapabilities: RtpCapabilities =
preferredEncrypt
:
false
,
preferredEncrypt
:
false
,
direction
:
'sendrecv'
direction
:
'sendrecv'
}
}
],
]
fecMechanisms
:
[]
};
};
export
{
supportedRtpCapabilities
};
export
{
supportedRtpCapabilities
};
test/test-Consumer.js
浏览文件 @
e51c3af8
...
@@ -106,9 +106,9 @@ const videoProducerParameters =
...
@@ -106,9 +106,9 @@ const videoProducerParameters =
},
},
rtcpFeedback
:
rtcpFeedback
:
[
[
{
type
:
'nack'
},
{
type
:
'nack'
,
parameter
:
''
},
{
type
:
'nack'
,
parameter
:
'pli'
},
{
type
:
'nack'
,
parameter
:
'pli'
},
{
type
:
'goog-remb'
}
{
type
:
'goog-remb'
,
parameter
:
''
}
]
]
},
},
{
{
...
@@ -151,39 +151,39 @@ const consumerDeviceCapabilities =
...
@@ -151,39 +151,39 @@ const consumerDeviceCapabilities =
{
{
mimeType
:
'audio/opus'
,
mimeType
:
'audio/opus'
,
kind
:
'audio'
,
kind
:
'audio'
,
clockRate
:
48000
,
preferredPayloadType
:
100
,
preferredPayloadType
:
100
,
clockRate
:
48000
,
channels
:
2
channels
:
2
},
},
{
{
mimeType
:
'video/H264'
,
mimeType
:
'video/H264'
,
kind
:
'video'
,
kind
:
'video'
,
clockRate
:
90000
,
preferredPayloadType
:
101
,
preferredPayloadType
:
101
,
rtcpFeedback
:
clockRate
:
90000
,
[
parameters
:
{
type
:
'nack'
},
{
type
:
'nack'
,
parameter
:
'pli'
},
{
type
:
'ccm'
,
parameter
:
'fir'
},
{
type
:
'goog-remb'
}
],
parameters
:
{
{
'level-asymmetry-allowed'
:
1
,
'level-asymmetry-allowed'
:
1
,
'packetization-mode'
:
1
,
'packetization-mode'
:
1
,
'profile-level-id'
:
'4d0032'
'profile-level-id'
:
'4d0032'
}
},
rtcpFeedback
:
[
{
type
:
'nack'
,
parameter
:
''
},
{
type
:
'nack'
,
parameter
:
'pli'
},
{
type
:
'ccm'
,
parameter
:
'fir'
},
{
type
:
'goog-remb'
,
parameter
:
''
}
]
},
},
{
{
mimeType
:
'video/rtx'
,
mimeType
:
'video/rtx'
,
kind
:
'video'
,
kind
:
'video'
,
clockRate
:
90000
,
preferredPayloadType
:
102
,
preferredPayloadType
:
102
,
rtcpFeedback
:
[]
,
clockRate
:
90000
,
parameters
:
parameters
:
{
{
apt
:
101
apt
:
101
}
},
rtcpFeedback
:
[]
}
}
],
],
headerExtensions
:
headerExtensions
:
...
@@ -236,8 +236,7 @@ const consumerDeviceCapabilities =
...
@@ -236,8 +236,7 @@ const consumerDeviceCapabilities =
preferredId
:
12
,
preferredId
:
12
,
preferredEncrypt
:
false
preferredEncrypt
:
false
}
}
],
]
fecMechanisms
:
[]
};
};
beforeAll
(
async
()
=>
beforeAll
(
async
()
=>
...
@@ -293,8 +292,8 @@ test('transport.consume() succeeds', async () =>
...
@@ -293,8 +292,8 @@ test('transport.consume() succeeds', async () =>
expect
(
audioConsumer
.
rtpParameters
.
codecs
[
0
]).
toEqual
(
expect
(
audioConsumer
.
rtpParameters
.
codecs
[
0
]).
toEqual
(
{
{
mimeType
:
'audio/opus'
,
mimeType
:
'audio/opus'
,
clockRate
:
48000
,
payloadType
:
100
,
payloadType
:
100
,
clockRate
:
48000
,
channels
:
2
,
channels
:
2
,
parameters
:
parameters
:
{
{
...
@@ -363,8 +362,9 @@ test('transport.consume() succeeds', async () =>
...
@@ -363,8 +362,9 @@ test('transport.consume() succeeds', async () =>
expect
(
videoConsumer
.
rtpParameters
.
codecs
[
0
]).
toEqual
(
expect
(
videoConsumer
.
rtpParameters
.
codecs
[
0
]).
toEqual
(
{
{
mimeType
:
'video/H264'
,
mimeType
:
'video/H264'
,
clockRate
:
90000
,
payloadType
:
103
,
payloadType
:
103
,
clockRate
:
90000
,
channels
:
1
,
parameters
:
parameters
:
{
{
'packetization-mode'
:
1
,
'packetization-mode'
:
1
,
...
@@ -372,17 +372,18 @@ test('transport.consume() succeeds', async () =>
...
@@ -372,17 +372,18 @@ test('transport.consume() succeeds', async () =>
},
},
rtcpFeedback
:
rtcpFeedback
:
[
[
{
type
:
'nack'
},
{
type
:
'nack'
,
parameter
:
''
},
{
type
:
'nack'
,
parameter
:
'pli'
},
{
type
:
'nack'
,
parameter
:
'pli'
},
{
type
:
'ccm'
,
parameter
:
'fir'
},
{
type
:
'ccm'
,
parameter
:
'fir'
},
{
type
:
'goog-remb'
}
{
type
:
'goog-remb'
,
parameter
:
''
}
]
]
});
});
expect
(
videoConsumer
.
rtpParameters
.
codecs
[
1
]).
toEqual
(
expect
(
videoConsumer
.
rtpParameters
.
codecs
[
1
]).
toEqual
(
{
{
mimeType
:
'video/rtx'
,
mimeType
:
'video/rtx'
,
clockRate
:
90000
,
payloadType
:
104
,
payloadType
:
104
,
clockRate
:
90000
,
channels
:
1
,
parameters
:
{
apt
:
103
},
parameters
:
{
apt
:
103
},
rtcpFeedback
:
[]
rtcpFeedback
:
[]
});
});
...
@@ -432,8 +433,8 @@ test('transport.consume() with incompatible rtpCapabilities rejects with Unsuppo
...
@@ -432,8 +433,8 @@ test('transport.consume() with incompatible rtpCapabilities rejects with Unsuppo
{
{
kind
:
'audio'
,
kind
:
'audio'
,
mimeType
:
'audio/ISAC'
,
mimeType
:
'audio/ISAC'
,
clockRate
:
32000
,
preferredPayloadType
:
100
,
preferredPayloadType
:
100
,
clockRate
:
32000
,
channels
:
1
channels
:
1
}
}
],
],
...
...
test/test-PipeTransport.js
浏览文件 @
e51c3af8
...
@@ -138,17 +138,17 @@ const consumerDeviceCapabilities =
...
@@ -138,17 +138,17 @@ const consumerDeviceCapabilities =
codecs
:
codecs
:
[
[
{
{
mimeType
:
'audio/opus'
,
kind
:
'audio'
,
kind
:
'audio'
,
clockRate
:
48000
,
mimeType
:
'audio/opus'
,
preferredPayloadType
:
100
,
preferredPayloadType
:
100
,
clockRate
:
48000
,
channels
:
2
channels
:
2
},
},
{
{
mimeType
:
'video/VP8'
,
kind
:
'video'
,
kind
:
'video'
,
clockRate
:
90000
,
mimeType
:
'video/VP8'
,
preferredPayloadType
:
101
,
preferredPayloadType
:
101
,
clockRate
:
90000
,
rtcpFeedback
:
rtcpFeedback
:
[
[
{
type
:
'nack'
},
{
type
:
'nack'
},
...
@@ -158,15 +158,15 @@ const consumerDeviceCapabilities =
...
@@ -158,15 +158,15 @@ const consumerDeviceCapabilities =
]
]
},
},
{
{
mimeType
:
'video/rtx'
,
kind
:
'video'
,
kind
:
'video'
,
clockRate
:
90000
,
mimeType
:
'video/rtx'
,
preferredPayloadType
:
102
,
preferredPayloadType
:
102
,
rtcpFeedback
:
[]
,
clockRate
:
90000
,
parameters
:
parameters
:
{
{
apt
:
101
apt
:
101
}
},
rtcpFeedback
:
[]
}
}
],
],
headerExtensions
:
headerExtensions
:
...
@@ -270,8 +270,10 @@ test('router.pipeToRouter() succeeds with audio', async () =>
...
@@ -270,8 +270,10 @@ test('router.pipeToRouter() succeeds with audio', async () =>
expect
(
pipeConsumer
.
rtpParameters
.
headerExtensions
).
toEqual
(
expect
(
pipeConsumer
.
rtpParameters
.
headerExtensions
).
toEqual
(
[
[
{
{
uri
:
'urn:ietf:params:rtp-hdrext:ssrc-audio-level'
,
uri
:
'urn:ietf:params:rtp-hdrext:ssrc-audio-level'
,
id
:
10
id
:
10
,
encrypt
:
false
,
parameters
:
{}
}
}
]);
]);
expect
(
pipeConsumer
.
rtpParameters
.
encodings
).
toEqual
(
expect
(
pipeConsumer
.
rtpParameters
.
encodings
).
toEqual
(
...
@@ -293,8 +295,8 @@ test('router.pipeToRouter() succeeds with audio', async () =>
...
@@ -293,8 +295,8 @@ test('router.pipeToRouter() succeeds with audio', async () =>
[
[
{
{
mimeType
:
'audio/opus'
,
mimeType
:
'audio/opus'
,
clockRate
:
48000
,
payloadType
:
100
,
payloadType
:
100
,
clockRate
:
48000
,
channels
:
2
,
channels
:
2
,
parameters
:
parameters
:
{
{
...
@@ -307,8 +309,10 @@ test('router.pipeToRouter() succeeds with audio', async () =>
...
@@ -307,8 +309,10 @@ test('router.pipeToRouter() succeeds with audio', async () =>
expect
(
pipeProducer
.
rtpParameters
.
headerExtensions
).
toEqual
(
expect
(
pipeProducer
.
rtpParameters
.
headerExtensions
).
toEqual
(
[
[
{
{
uri
:
'urn:ietf:params:rtp-hdrext:ssrc-audio-level'
,
uri
:
'urn:ietf:params:rtp-hdrext:ssrc-audio-level'
,
id
:
10
id
:
10
,
encrypt
:
false
,
parameters
:
{}
}
}
]);
]);
expect
(
pipeProducer
.
rtpParameters
.
encodings
).
toEqual
(
expect
(
pipeProducer
.
rtpParameters
.
encodings
).
toEqual
(
...
@@ -347,8 +351,10 @@ test('router.pipeToRouter() succeeds with video', async () =>
...
@@ -347,8 +351,10 @@ test('router.pipeToRouter() succeeds with video', async () =>
[
[
{
{
mimeType
:
'video/VP8'
,
mimeType
:
'video/VP8'
,
clockRate
:
90000
,
payloadType
:
101
,
payloadType
:
101
,
clockRate
:
90000
,
channels
:
1
,
parameters
:
{},
rtcpFeedback
:
rtcpFeedback
:
[
[
{
type
:
'nack'
,
parameter
:
'pli'
},
{
type
:
'nack'
,
parameter
:
'pli'
},
...
@@ -360,20 +366,28 @@ test('router.pipeToRouter() succeeds with video', async () =>
...
@@ -360,20 +366,28 @@ test('router.pipeToRouter() succeeds with video', async () =>
[
[
// NOTE: Remove this once framemarking draft becomes RFC.
// NOTE: Remove this once framemarking draft becomes RFC.
{
{
uri
:
'http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07'
,
uri
:
'http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07'
,
id
:
6
id
:
6
,
encrypt
:
false
,
parameters
:
{}
},
},
{
{
uri
:
'urn:ietf:params:rtp-hdrext:framemarking'
,
uri
:
'urn:ietf:params:rtp-hdrext:framemarking'
,
id
:
7
id
:
7
,
encrypt
:
false
,
parameters
:
{}
},
},
{
{
uri
:
'urn:3gpp:video-orientation'
,
uri
:
'urn:3gpp:video-orientation'
,
id
:
11
id
:
11
,
encrypt
:
false
,
parameters
:
{}
},
},
{
{
uri
:
'urn:ietf:params:rtp-hdrext:toffset'
,
uri
:
'urn:ietf:params:rtp-hdrext:toffset'
,
id
:
12
id
:
12
,
encrypt
:
false
,
parameters
:
{}
}
}
]);
]);
expect
(
pipeConsumer
.
rtpParameters
.
encodings
).
toEqual
(
expect
(
pipeConsumer
.
rtpParameters
.
encodings
).
toEqual
(
...
@@ -398,8 +412,10 @@ test('router.pipeToRouter() succeeds with video', async () =>
...
@@ -398,8 +412,10 @@ test('router.pipeToRouter() succeeds with video', async () =>
[
[
{
{
mimeType
:
'video/VP8'
,
mimeType
:
'video/VP8'
,
clockRate
:
90000
,
payloadType
:
101
,
payloadType
:
101
,
clockRate
:
90000
,
channels
:
1
,
parameters
:
{},
rtcpFeedback
:
rtcpFeedback
:
[
[
{
type
:
'nack'
,
parameter
:
'pli'
},
{
type
:
'nack'
,
parameter
:
'pli'
},
...
@@ -411,20 +427,28 @@ test('router.pipeToRouter() succeeds with video', async () =>
...
@@ -411,20 +427,28 @@ test('router.pipeToRouter() succeeds with video', async () =>
[
[
// NOTE: Remove this once framemarking draft becomes RFC.
// NOTE: Remove this once framemarking draft becomes RFC.
{
{
uri
:
'http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07'
,
uri
:
'http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07'
,
id
:
6
id
:
6
,
encrypt
:
false
,
parameters
:
{}
},
},
{
{
uri
:
'urn:ietf:params:rtp-hdrext:framemarking'
,
uri
:
'urn:ietf:params:rtp-hdrext:framemarking'
,
id
:
7
id
:
7
,
encrypt
:
false
,
parameters
:
{}
},
},
{
{
uri
:
'urn:3gpp:video-orientation'
,
uri
:
'urn:3gpp:video-orientation'
,
id
:
11
id
:
11
,
encrypt
:
false
,
parameters
:
{}
},
},
{
{
uri
:
'urn:ietf:params:rtp-hdrext:toffset'
,
uri
:
'urn:ietf:params:rtp-hdrext:toffset'
,
id
:
12
id
:
12
,
encrypt
:
false
,
parameters
:
{}
}
}
]);
]);
expect
(
pipeProducer
.
paused
).
toBe
(
true
);
expect
(
pipeProducer
.
paused
).
toBe
(
true
);
...
@@ -447,36 +471,43 @@ test('transport.consume() for a pipe Producer succeeds', async () =>
...
@@ -447,36 +471,43 @@ test('transport.consume() for a pipe Producer succeeds', async () =>
[
[
{
{
mimeType
:
'video/VP8'
,
mimeType
:
'video/VP8'
,
clockRate
:
90000
,
payloadType
:
101
,
payloadType
:
101
,
clockRate
:
90000
,
channels
:
1
,
parameters
:
{},
rtcpFeedback
:
rtcpFeedback
:
[
[
{
type
:
'nack'
},
{
type
:
'nack'
,
parameter
:
''
},
{
type
:
'ccm'
,
parameter
:
'fir'
},
{
type
:
'ccm'
,
parameter
:
'fir'
},
{
type
:
'google-remb'
},
{
type
:
'google-remb'
,
parameter
:
''
},
{
type
:
'transport-cc'
}
{
type
:
'transport-cc'
,
parameter
:
''
}
]
]
},
},
{
{
mimeType
:
'video/rtx'
,
mimeType
:
'video/rtx'
,
clockRate
:
90000
,
payloadType
:
102
,
payloadType
:
102
,
clockRate
:
90000
,
rtcpFeedback
:
[]
,
channels
:
1
,
parameters
:
parameters
:
{
{
apt
:
101
apt
:
101
}
},
rtcpFeedback
:
[]
}
}
]);
]);
expect
(
videoConsumer
.
rtpParameters
.
headerExtensions
).
toEqual
(
expect
(
videoConsumer
.
rtpParameters
.
headerExtensions
).
toEqual
(
[
[
{
{
uri
:
'http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time'
,
uri
:
'http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time'
,
id
:
4
id
:
4
,
encrypt
:
false
,
parameters
:
{}
},
},
{
{
uri
:
'http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01'
,
uri
:
'http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01'
,
id
:
5
id
:
5
,
encrypt
:
false
,
parameters
:
{}
}
}
]);
]);
expect
(
videoConsumer
.
rtpParameters
.
encodings
.
length
).
toBe
(
1
);
expect
(
videoConsumer
.
rtpParameters
.
encodings
.
length
).
toBe
(
1
);
...
...
test/test-PlainRtpTransport.js
浏览文件 @
e51c3af8
...
@@ -27,17 +27,17 @@ const mediaCodecs =
...
@@ -27,17 +27,17 @@ const mediaCodecs =
clockRate
:
90000
clockRate
:
90000
},
},
{
{
kind
:
'video'
,
kind
:
'video'
,
mimeType
:
'video/H264'
,
mimeType
:
'video/H264'
,
clockRate
:
90000
,
clockRate
:
90000
,
rtcpFeedback
:
[],
// Will be ignored.
parameters
:
parameters
:
{
{
'level-asymmetry-allowed'
:
1
,
'level-asymmetry-allowed'
:
1
,
'packetization-mode'
:
1
,
'packetization-mode'
:
1
,
'profile-level-id'
:
'4d0032'
,
'profile-level-id'
:
'4d0032'
,
foo
:
'bar'
foo
:
'bar'
}
},
rtcpFeedback
:
[]
// Will be ignored.
}
}
];
];
...
...
test/test-Producer.js
浏览文件 @
e51c3af8
...
@@ -30,17 +30,17 @@ const mediaCodecs =
...
@@ -30,17 +30,17 @@ const mediaCodecs =
clockRate
:
90000
clockRate
:
90000
},
},
{
{
kind
:
'video'
,
kind
:
'video'
,
mimeType
:
'video/H264'
,
mimeType
:
'video/H264'
,
clockRate
:
90000
,
clockRate
:
90000
,
rtcpFeedback
:
[],
// Will be ignored.
parameters
:
parameters
:
{
{
'level-asymmetry-allowed'
:
1
,
'level-asymmetry-allowed'
:
1
,
'packetization-mode'
:
1
,
'packetization-mode'
:
1
,
'profile-level-id'
:
'4d0032'
,
'profile-level-id'
:
'4d0032'
,
foo
:
'bar'
foo
:
'bar'
}
},
rtcpFeedback
:
[]
// Will be ignored.
}
}
];
];
...
...
test/test-Router.js
浏览文件 @
e51c3af8
...
@@ -29,16 +29,16 @@ const mediaCodecs =
...
@@ -29,16 +29,16 @@ const mediaCodecs =
clockRate
:
90000
clockRate
:
90000
},
},
{
{
kind
:
'video'
,
kind
:
'video'
,
mimeType
:
'video/H264'
,
mimeType
:
'video/H264'
,
clockRate
:
90000
,
clockRate
:
90000
,
rtcpFeedback
:
[],
// Will be ignored.
parameters
:
parameters
:
{
{
'level-asymmetry-allowed'
:
1
,
'level-asymmetry-allowed'
:
1
,
'packetization-mode'
:
1
,
'packetization-mode'
:
1
,
'profile-level-id'
:
'4d0032'
'profile-level-id'
:
'4d0032'
}
},
rtcpFeedback
:
[]
// Will be ignored.
}
}
];
];
...
@@ -59,7 +59,6 @@ test('worker.createRouter() succeeds', async () =>
...
@@ -59,7 +59,6 @@ test('worker.createRouter() succeeds', async () =>
expect
(
router
.
rtpCapabilities
).
toBeType
(
'object'
);
expect
(
router
.
rtpCapabilities
).
toBeType
(
'object'
);
expect
(
router
.
rtpCapabilities
.
codecs
).
toBeType
(
'array'
);
expect
(
router
.
rtpCapabilities
.
codecs
).
toBeType
(
'array'
);
expect
(
router
.
rtpCapabilities
.
headerExtensions
).
toBeType
(
'array'
);
expect
(
router
.
rtpCapabilities
.
headerExtensions
).
toBeType
(
'array'
);
expect
(
router
.
rtpCapabilities
.
fecMechanisms
).
toEqual
([]);
expect
(
router
.
appData
).
toEqual
({
foo
:
123
});
expect
(
router
.
appData
).
toEqual
({
foo
:
123
});
await
expect
(
worker
.
dump
())
await
expect
(
worker
.
dump
())
...
...
test/test-ortc.js
浏览文件 @
e51c3af8
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论