Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
6961afb1
Unverified
提交
6961afb1
authored
1月 04, 2021
作者:
Iñaki Baz Castillo
提交者:
GitHub
1月 04, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add pipe boolean option to transport.consume() (#494)
上级
e06c153c
隐藏空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
256 行增加
和
113 行删除
+256
-113
CHANGELOG.md
CHANGELOG.md
+4
-1
Consumer.d.ts
lib/Consumer.d.ts
+5
-0
Consumer.d.ts.map
lib/Consumer.d.ts.map
+2
-2
Transport.d.ts
lib/Transport.d.ts
+1
-1
Transport.d.ts.map
lib/Transport.d.ts.map
+2
-2
Transport.js
lib/Transport.js
+15
-9
ortc.d.ts
lib/ortc.d.ts
+1
-1
ortc.d.ts.map
lib/ortc.d.ts.map
+2
-2
ortc.js
lib/ortc.js
+45
-31
Consumer.ts
src/Consumer.ts
+6
-0
Transport.ts
src/Transport.ts
+19
-10
ortc.ts
src/ortc.ts
+58
-36
test-Consumer.js
test/test-Consumer.js
+96
-18
没有找到文件。
CHANGELOG.md
浏览文件 @
6961afb1
# Changelog
# Changelog
### 3.
6
.30 (WIP)
### 3.
7
.30 (WIP)
*
Add
`pipe`
option to
`transport.consume()`
(PR #494).
-
So the receiver will get all streams from the
`Producer`
.
-
It works for any kind of transport (but
`PipeTransport`
which is always like this).
*
Update NPM deps.
*
Update NPM deps.
*
Add
`LICENSE`
and
`PATENTS`
files in
`libwebrtc`
dependency (issue #495).
*
Add
`LICENSE`
and
`PATENTS`
files in
`libwebrtc`
dependency (issue #495).
*
Added
`worker/src/Utils/README_BASE64_UTILS`
(issue #497).
*
Added
`worker/src/Utils/README_BASE64_UTILS`
(issue #497).
...
...
lib/Consumer.d.ts
浏览文件 @
6961afb1
...
@@ -32,6 +32,11 @@ export declare type ConsumerOptions = {
...
@@ -32,6 +32,11 @@ export declare type ConsumerOptions = {
* If unset, the highest ones are selected.
* If unset, the highest ones are selected.
*/
*/
preferredLayers
?:
ConsumerLayers
;
preferredLayers
?:
ConsumerLayers
;
/**
* Whether this Consumer should consume all RTP streams generated by the
* Producer.
*/
pipe
?:
boolean
;
/**
/**
* Custom application data.
* Custom application data.
*/
*/
...
...
lib/Consumer.d.ts.map
浏览文件 @
6961afb1
{"version":3,"file":"Consumer.d.ts","sourceRoot":"","sources":["../src/Consumer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EACN,SAAS,EACT,eAAe,EACf,aAAa,EACb,MAAM,iBAAiB,CAAC;AAEzB,oBAAY,eAAe,GAC3B;IACC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;IAElC;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;OAGG;IACH,eAAe,CAAC,EAAE,cAAc,CAAC;IAEjC;;OAEG;IACH,OAAO,CAAC,EAAE,GAAG,CAAC;CACd,CAAA;AAED;;GAEG;AACH,oBAAY,sBAAsB,GAAG,KAAK,GAAG,UAAU,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;AAEjF;;GAEG;AACH,oBAAY,sBAAsB,GAClC;IACC;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AI,OAAO,IAAI,GAAG,CAGjB;IAED;;OAEG;IACH,IAAI,OAAO,CAAC,OAAO,EARJ,GAQI,EAGlB;IAED;;;;;;;;;OASG;IACH,IAAI,QAAQ,IAAI,oBAAoB,CAGnC;IAED;;OAEG;IACH,KAAK,IAAI,IAAI;IAsBb;;;;OAIG;IACH,eAAe,IAAI,IAAI;IAmBvB;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC;IAO1B;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,KAAK,CAAC,YAAY,GAAG,YAAY,CAAC,CAAC;IAO7D;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAe5B;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAe7B;;OAEG;IACG,kBAAkB,CACvB,EACC,YAAY,EACZ,aAAa,EACb,EAAE,cAAc,GACf,OAAO,CAAC,IAAI,CAAC;IAYhB;;OAEG;IACG,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAYlD;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAYpC;;OAEG;IACG,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAOtC;;OAEG;IACG,gBAAgB,CAAC,KAAK,GAAE,sBAAsB,EAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAU3E,OAAO,CAAC,0BAA0B;CAsIlC"}
\ No newline at end of file
\ No newline at end of file
lib/Transport.d.ts
浏览文件 @
6961afb1
...
@@ -166,7 +166,7 @@ export declare class Transport extends EnhancedEventEmitter {
...
@@ -166,7 +166,7 @@ export declare class Transport extends EnhancedEventEmitter {
*
*
* @virtual
* @virtual
*/
*/
consume
({
producerId
,
rtpCapabilities
,
paused
,
preferredLayers
,
appData
}:
ConsumerOptions
):
Promise
<
Consumer
>
;
consume
({
producerId
,
rtpCapabilities
,
paused
,
preferredLayers
,
pipe
,
appData
}:
ConsumerOptions
):
Promise
<
Consumer
>
;
/**
/**
* Create a DataProducer.
* Create a DataProducer.
*/
*/
...
...
lib/Transport.d.ts.map
浏览文件 @
6961afb1
{"version":3,"file":"Transport.d.ts","sourceRoot":"","sources":["../src/Transport.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAG9D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EACN,YAAY,EACZ,mBAAmB,EAEnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACN,YAAY,EACZ,mBAAmB,EAEnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAwB,MAAM,kBAAkB,CAAC;AAExE,MAAM,WAAW,iBAAiB;IAEjC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,oBAAY,iBAAiB,GAAG,KAAK,GAAG,KAAK,CAAC;AAE9C,MAAM,WAAW,cAAc;IAE9B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,iBAAiB,CAAC;CAC5B;AAED;;GAEG;AACH,oBAAY,uBAAuB,GAAG,WAAW,GAAG,KAAK,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,uBAAuB;IAEvC;;OAEG;IACH,IAAI,EAAE,uBAAuB,CAAC;IAE9B;;OAEG;IACH,SAAS,EA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ChB,EACC,cAAc,EACd,OAAO,EACP,iBAAiB,EACjB,cAAc,EACd,OAAY,EACZ,EAAE,mBAAmB,GACpB,OAAO,CAAC,YAAY,CAAC;IAuGxB;;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
浏览文件 @
6961afb1
...
@@ -275,7 +275,7 @@ class Transport extends EnhancedEventEmitter_1.EnhancedEventEmitter {
...
@@ -275,7 +275,7 @@ class Transport extends EnhancedEventEmitter_1.EnhancedEventEmitter {
*
*
* @virtual
* @virtual
*/
*/
async
consume
({
producerId
,
rtpCapabilities
,
paused
=
false
,
preferredLayers
,
appData
=
{}
})
{
async
consume
({
producerId
,
rtpCapabilities
,
paused
=
false
,
preferredLayers
,
pipe
=
false
,
appData
=
{}
})
{
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'
);
...
@@ -287,25 +287,31 @@ class Transport extends EnhancedEventEmitter_1.EnhancedEventEmitter {
...
@@ -287,25 +287,31 @@ class Transport extends EnhancedEventEmitter_1.EnhancedEventEmitter {
if
(
!
producer
)
if
(
!
producer
)
throw
Error
(
`Producer with id "
${
producerId
}
" not found`
);
throw
Error
(
`Producer with id "
${
producerId
}
" not found`
);
// This may throw.
// This may throw.
const
rtpParameters
=
ortc
.
getConsumerRtpParameters
(
producer
.
consumableRtpParameters
,
rtpCapabilities
);
const
rtpParameters
=
ortc
.
getConsumerRtpParameters
(
producer
.
consumableRtpParameters
,
rtpCapabilities
,
pipe
);
// Set MID.
// Set MID.
rtpParameters
.
mid
=
`
${
this
.
_nextMidForConsumers
++
}
`
;
if
(
!
pipe
)
{
// We use up to 8 bytes for MID (string).
rtpParameters
.
mid
=
`
${
this
.
_nextMidForConsumers
++
}
`
;
if
(
this
.
_nextMidForConsumers
===
100000000
)
{
// We use up to 8 bytes for MID (string).
logger
.
error
(
`consume() | reaching max MID value "
${
this
.
_nextMidForConsumers
}
"`
);
if
(
this
.
_nextMidForConsumers
===
100000000
)
{
this
.
_nextMidForConsumers
=
0
;
logger
.
error
(
`consume() | reaching max MID value "
${
this
.
_nextMidForConsumers
}
"`
);
this
.
_nextMidForConsumers
=
0
;
}
}
}
const
internal
=
{
...
this
.
_internal
,
consumerId
:
uuid_1
.
v4
(),
producerId
};
const
internal
=
{
...
this
.
_internal
,
consumerId
:
uuid_1
.
v4
(),
producerId
};
const
reqData
=
{
const
reqData
=
{
kind
:
producer
.
kind
,
kind
:
producer
.
kind
,
rtpParameters
,
rtpParameters
,
type
:
producer
.
type
,
type
:
p
ipe
?
'pipe'
:
p
roducer
.
type
,
consumableRtpEncodings
:
producer
.
consumableRtpParameters
.
encodings
,
consumableRtpEncodings
:
producer
.
consumableRtpParameters
.
encodings
,
paused
,
paused
,
preferredLayers
preferredLayers
};
};
const
status
=
await
this
.
_channel
.
request
(
'transport.consume'
,
internal
,
reqData
);
const
status
=
await
this
.
_channel
.
request
(
'transport.consume'
,
internal
,
reqData
);
const
data
=
{
kind
:
producer
.
kind
,
rtpParameters
,
type
:
producer
.
type
};
const
data
=
{
kind
:
producer
.
kind
,
rtpParameters
,
type
:
pipe
?
'pipe'
:
producer
.
type
};
const
consumer
=
new
Consumer_1
.
Consumer
({
const
consumer
=
new
Consumer_1
.
Consumer
({
internal
,
internal
,
data
,
data
,
...
...
lib/ortc.d.ts
浏览文件 @
6961afb1
...
@@ -118,7 +118,7 @@ export declare function canConsume(consumableParams: RtpParameters, caps: RtpCap
...
@@ -118,7 +118,7 @@ export declare function canConsume(consumableParams: RtpParameters, caps: RtpCap
* to reduce codecs, codecs' RTCP feedback and header extensions, and also enables
* to reduce codecs, codecs' RTCP feedback and header extensions, and also enables
* or disabled RTX.
* or disabled RTX.
*/
*/
export
declare
function
getConsumerRtpParameters
(
consumableParams
:
RtpParameters
,
caps
:
RtpCapabilities
):
RtpParameters
;
export
declare
function
getConsumerRtpParameters
(
consumableParams
:
RtpParameters
,
caps
:
RtpCapabilities
,
pipe
:
boolean
):
RtpParameters
;
/**
/**
* Generate RTP parameters for a pipe Consumer.
* Generate RTP parameters for a pipe Consumer.
*
*
...
...
lib/ortc.d.ts.map
浏览文件 @
6961afb1
{"version":3,"file":"ortc.d.ts","sourceRoot":"","sources":["../src/ortc.ts"],"names":[],"mappings":"AAKA,OAAO,EACN,eAAe,EAEf,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,qBAAqB,EACrB,4BAA4B,EAC5B,cAAc,EACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACN,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,MAAM,kBAAkB,CAAC;AAE1B,aAAK,UAAU,GACf;IACC,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,CAAA;AASD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,CA0BnE;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,kBAAkB,GAAG,IAAI,CA0E1E;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CAY3D;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,kBAAkB,GAAG,IAA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BAA4B,CAC3C,gBAAgB,EAAE,aAAa,EAC/B,SAAS,UAAQ,GACf,aAAa,CAwDf"}
\ No newline at end of file
\ No newline at end of file
lib/ortc.js
浏览文件 @
6961afb1
...
@@ -652,7 +652,7 @@ exports.canConsume = canConsume;
...
@@ -652,7 +652,7 @@ exports.canConsume = canConsume;
* to reduce codecs, codecs' RTCP feedback and header extensions, and also enables
* to reduce codecs, codecs' RTCP feedback and header extensions, and also enables
* or disabled RTX.
* or disabled RTX.
*/
*/
function
getConsumerRtpParameters
(
consumableParams
,
caps
)
{
function
getConsumerRtpParameters
(
consumableParams
,
caps
,
pipe
)
{
const
consumerParams
=
{
const
consumerParams
=
{
codecs
:
[],
codecs
:
[],
headerExtensions
:
[],
headerExtensions
:
[],
...
@@ -713,36 +713,50 @@ function getConsumerRtpParameters(consumableParams, caps) {
...
@@ -713,36 +713,50 @@ function getConsumerRtpParameters(consumableParams, caps) {
fb
.
type
!==
'goog-remb'
));
fb
.
type
!==
'goog-remb'
));
}
}
}
}
const
consumerEncoding
=
{
if
(
!
pipe
)
{
ssrc
:
utils
.
generateRandomNumber
()
const
consumerEncoding
=
{
};
ssrc
:
utils
.
generateRandomNumber
()
if
(
rtxSupported
)
};
consumerEncoding
.
rtx
=
{
ssrc
:
utils
.
generateRandomNumber
()
};
if
(
rtxSupported
)
// If any of the consumableParams.encodings has scalabilityMode, process it
consumerEncoding
.
rtx
=
{
ssrc
:
consumerEncoding
.
ssrc
+
1
};
// (assume all encodings have the same value).
// If any of the consumableParams.encodings has scalabilityMode, process it
const
encodingWithScalabilityMode
=
consumableParams
.
encodings
.
find
((
encoding
)
=>
encoding
.
scalabilityMode
);
// (assume all encodings have the same value).
let
scalabilityMode
=
encodingWithScalabilityMode
const
encodingWithScalabilityMode
=
consumableParams
.
encodings
.
find
((
encoding
)
=>
encoding
.
scalabilityMode
);
?
encodingWithScalabilityMode
.
scalabilityMode
let
scalabilityMode
=
encodingWithScalabilityMode
:
undefined
;
?
encodingWithScalabilityMode
.
scalabilityMode
// If there is simulast, mangle spatial layers in scalabilityMode.
:
undefined
;
if
(
consumableParams
.
encodings
.
length
>
1
)
{
// If there is simulast, mangle spatial layers in scalabilityMode.
const
{
temporalLayers
}
=
scalabilityModes_1
.
parse
(
scalabilityMode
);
if
(
consumableParams
.
encodings
.
length
>
1
)
{
scalabilityMode
=
`S
${
consumableParams
.
encodings
.
length
}
T
${
temporalLayers
}
`
;
const
{
temporalLayers
}
=
scalabilityModes_1
.
parse
(
scalabilityMode
);
}
scalabilityMode
=
`S
${
consumableParams
.
encodings
.
length
}
T
${
temporalLayers
}
`
;
if
(
scalabilityMode
)
}
consumerEncoding
.
scalabilityMode
=
scalabilityMode
;
if
(
scalabilityMode
)
// Use the maximum maxBitrate in any encoding and honor it in the Consumer's
consumerEncoding
.
scalabilityMode
=
scalabilityMode
;
// encoding.
// Use the maximum maxBitrate in any encoding and honor it in the Consumer's
const
maxEncodingMaxBitrate
=
consumableParams
.
encodings
.
reduce
((
maxBitrate
,
encoding
)
=>
(
encoding
.
maxBitrate
&&
encoding
.
maxBitrate
>
maxBitrate
// encoding.
?
encoding
.
maxBitrate
const
maxEncodingMaxBitrate
=
consumableParams
.
encodings
.
reduce
((
maxBitrate
,
encoding
)
=>
(
encoding
.
maxBitrate
&&
encoding
.
maxBitrate
>
maxBitrate
:
maxBitrate
),
0
);
?
encoding
.
maxBitrate
if
(
maxEncodingMaxBitrate
)
{
:
maxBitrate
),
0
);
consumerEncoding
.
maxBitrate
=
maxEncodingMaxBitrate
;
if
(
maxEncodingMaxBitrate
)
{
}
consumerEncoding
.
maxBitrate
=
maxEncodingMaxBitrate
;
// Set a single encoding for the Consumer.
}
consumerParams
.
encodings
.
push
(
consumerEncoding
);
// Set a single encoding for the Consumer.
// Copy verbatim.
consumerParams
.
encodings
.
push
(
consumerEncoding
);
consumerParams
.
rtcp
=
consumableParams
.
rtcp
;
}
else
{
const
consumableEncodings
=
utils
.
clone
(
consumableParams
.
encodings
);
const
baseSsrc
=
utils
.
generateRandomNumber
();
const
baseRtxSsrc
=
utils
.
generateRandomNumber
();
for
(
let
i
=
0
;
i
<
consumableEncodings
.
length
;
++
i
)
{
const
encoding
=
consumableEncodings
[
i
];
encoding
.
ssrc
=
baseSsrc
+
i
;
if
(
rtxSupported
)
encoding
.
rtx
=
{
ssrc
:
baseRtxSsrc
+
i
};
else
delete
encoding
.
rtx
;
consumerParams
.
encodings
.
push
(
encoding
);
}
}
return
consumerParams
;
return
consumerParams
;
}
}
exports
.
getConsumerRtpParameters
=
getConsumerRtpParameters
;
exports
.
getConsumerRtpParameters
=
getConsumerRtpParameters
;
...
...
src/Consumer.ts
浏览文件 @
6961afb1
...
@@ -43,6 +43,12 @@ export type ConsumerOptions =
...
@@ -43,6 +43,12 @@ export type ConsumerOptions =
*/
*/
preferredLayers
?:
ConsumerLayers
;
preferredLayers
?:
ConsumerLayers
;
/**
* Whether this Consumer should consume all RTP streams generated by the
* Producer.
*/
pipe
?:
boolean
;
/**
/**
* Custom application data.
* Custom application data.
*/
*/
...
...
src/Transport.ts
浏览文件 @
6961afb1
...
@@ -522,6 +522,7 @@ export class Transport extends EnhancedEventEmitter
...
@@ -522,6 +522,7 @@ export class Transport extends EnhancedEventEmitter
rtpCapabilities
,
rtpCapabilities
,
paused
=
false
,
paused
=
false
,
preferredLayers
,
preferredLayers
,
pipe
=
false
,
appData
=
{}
appData
=
{}
}:
ConsumerOptions
}:
ConsumerOptions
):
Promise
<
Consumer
>
):
Promise
<
Consumer
>
...
@@ -543,18 +544,21 @@ export class Transport extends EnhancedEventEmitter
...
@@ -543,18 +544,21 @@ export class Transport extends EnhancedEventEmitter
// This may throw.
// This may throw.
const
rtpParameters
=
ortc
.
getConsumerRtpParameters
(
const
rtpParameters
=
ortc
.
getConsumerRtpParameters
(
producer
.
consumableRtpParameters
,
rtpCapabilities
!
);
producer
.
consumableRtpParameters
,
rtpCapabilities
!
,
pipe
);
// Set MID.
// Set MID.
rtpParameters
.
mid
=
`
${
this
.
_nextMidForConsumers
++
}
`
;
if
(
!
pipe
)
// We use up to 8 bytes for MID (string).
if
(
this
.
_nextMidForConsumers
===
100000000
)
{
{
logger
.
error
(
rtpParameters
.
mid
=
`
${
this
.
_nextMidForConsumers
++
}
`
;
`consume() | reaching max MID value "
${
this
.
_nextMidForConsumers
}
"`
);
// We use up to 8 bytes for MID (string).
if
(
this
.
_nextMidForConsumers
===
100000000
)
{
logger
.
error
(
`consume() | reaching max MID value "
${
this
.
_nextMidForConsumers
}
"`
);
this
.
_nextMidForConsumers
=
0
;
this
.
_nextMidForConsumers
=
0
;
}
}
}
const
internal
=
{
...
this
.
_internal
,
consumerId
:
uuidv4
(),
producerId
};
const
internal
=
{
...
this
.
_internal
,
consumerId
:
uuidv4
(),
producerId
};
...
@@ -562,7 +566,7 @@ export class Transport extends EnhancedEventEmitter
...
@@ -562,7 +566,7 @@ export class Transport extends EnhancedEventEmitter
{
{
kind
:
producer
.
kind
,
kind
:
producer
.
kind
,
rtpParameters
,
rtpParameters
,
type
:
producer
.
type
,
type
:
p
ipe
?
'pipe'
:
p
roducer
.
type
,
consumableRtpEncodings
:
producer
.
consumableRtpParameters
.
encodings
,
consumableRtpEncodings
:
producer
.
consumableRtpParameters
.
encodings
,
paused
,
paused
,
preferredLayers
preferredLayers
...
@@ -571,7 +575,12 @@ export class Transport extends EnhancedEventEmitter
...
@@ -571,7 +575,12 @@ export class Transport extends EnhancedEventEmitter
const
status
=
const
status
=
await
this
.
_channel
.
request
(
'transport.consume'
,
internal
,
reqData
);
await
this
.
_channel
.
request
(
'transport.consume'
,
internal
,
reqData
);
const
data
=
{
kind
:
producer
.
kind
,
rtpParameters
,
type
:
producer
.
type
};
const
data
=
{
kind
:
producer
.
kind
,
rtpParameters
,
type
:
pipe
?
'pipe'
:
producer
.
type
};
const
consumer
=
new
Consumer
(
const
consumer
=
new
Consumer
(
{
{
...
...
src/ortc.ts
浏览文件 @
6961afb1
...
@@ -939,7 +939,8 @@ export function canConsume(
...
@@ -939,7 +939,8 @@ export function canConsume(
*/
*/
export
function
getConsumerRtpParameters
(
export
function
getConsumerRtpParameters
(
consumableParams
:
RtpParameters
,
consumableParams
:
RtpParameters
,
caps
:
RtpCapabilities
caps
:
RtpCapabilities
,
pipe
:
boolean
):
RtpParameters
):
RtpParameters
{
{
const
consumerParams
:
RtpParameters
=
const
consumerParams
:
RtpParameters
=
...
@@ -1043,53 +1044,74 @@ export function getConsumerRtpParameters(
...
@@ -1043,53 +1044,74 @@ export function getConsumerRtpParameters(
}
}
}
}
const
consumerEncoding
:
RtpEncodingParameters
=
if
(
!
pipe
)
{
{
ssrc
:
utils
.
generateRandomNumber
()
const
consumerEncoding
:
RtpEncodingParameters
=
};
{
ssrc
:
utils
.
generateRandomNumber
()
};
if
(
rtxSupported
)
if
(
rtxSupported
)
consumerEncoding
.
rtx
=
{
ssrc
:
utils
.
generateRandomNumber
()
};
consumerEncoding
.
rtx
=
{
ssrc
:
consumerEncoding
.
ssrc
!
+
1
};
// If any of the consumableParams.encodings has scalabilityMode, process it
// If any of the consumableParams.encodings has scalabilityMode, process it
// (assume all encodings have the same value).
// (assume all encodings have the same value).
const
encodingWithScalabilityMode
=
const
encodingWithScalabilityMode
=
consumableParams
.
encodings
!
.
find
((
encoding
)
=>
encoding
.
scalabilityMode
);
consumableParams
.
encodings
!
.
find
((
encoding
)
=>
encoding
.
scalabilityMode
);
let
scalabilityMode
=
encodingWithScalabilityMode
let
scalabilityMode
=
encodingWithScalabilityMode
?
encodingWithScalabilityMode
.
scalabilityMode
?
encodingWithScalabilityMode
.
scalabilityMode
:
undefined
;
:
undefined
;
// If there is simulast, mangle spatial layers in scalabilityMode.
// If there is simulast, mangle spatial layers in scalabilityMode.
if
(
consumableParams
.
encodings
!
.
length
>
1
)
if
(
consumableParams
.
encodings
!
.
length
>
1
)
{
{
const
{
temporalLayers
}
=
parseScalabilityMode
(
scalabilityMode
);
const
{
temporalLayers
}
=
parseScalabilityMode
(
scalabilityMode
);
scalabilityMode
=
`S
${
consumableParams
.
encodings
!
.
length
}
T
${
temporalLayers
}
`
;
scalabilityMode
=
`S
${
consumableParams
.
encodings
!
.
length
}
T
${
temporalLayers
}
`
;
}
}
if
(
scalabilityMode
)
if
(
scalabilityMode
)
consumerEncoding
.
scalabilityMode
=
scalabilityMode
;
consumerEncoding
.
scalabilityMode
=
scalabilityMode
;
// Use the maximum maxBitrate in any encoding and honor it in the Consumer's
// Use the maximum maxBitrate in any encoding and honor it in the Consumer's
// encoding.
// encoding.
const
maxEncodingMaxBitrate
=
const
maxEncodingMaxBitrate
=
consumableParams
.
encodings
!
.
reduce
((
maxBitrate
,
encoding
)
=>
(
consumableParams
.
encodings
!
.
reduce
((
maxBitrate
,
encoding
)
=>
(
encoding
.
maxBitrate
&&
encoding
.
maxBitrate
>
maxBitrate
encoding
.
maxBitrate
&&
encoding
.
maxBitrate
>
maxBitrate
?
encoding
.
maxBitrate
?
encoding
.
maxBitrate
:
maxBitrate
:
maxBitrate
),
0
);
),
0
);
if
(
maxEncodingMaxBitrate
)
if
(
maxEncodingMaxBitrate
)
{
{
consumerEncoding
.
maxBitrate
=
maxEncodingMaxBitrate
;
consumerEncoding
.
maxBitrate
=
maxEncodingMaxBitrate
;
}
// Set a single encoding for the Consumer.
consumerParams
.
encodings
!
.
push
(
consumerEncoding
);
}
}
else
{
const
consumableEncodings
=
utils
.
clone
(
consumableParams
.
encodings
)
as
RtpEncodingParameters
[];
const
baseSsrc
=
utils
.
generateRandomNumber
();
const
baseRtxSsrc
=
utils
.
generateRandomNumber
();
for
(
let
i
=
0
;
i
<
consumableEncodings
.
length
;
++
i
)
{
const
encoding
=
consumableEncodings
[
i
];
encoding
.
ssrc
=
baseSsrc
+
i
;
// Set a single encoding for the Consumer.
if
(
rtxSupported
)
consumerParams
.
encodings
!
.
push
(
consumerEncoding
);
encoding
.
rtx
=
{
ssrc
:
baseRtxSsrc
+
i
};
else
delete
encoding
.
rtx
;
// Copy verbatim.
consumerParams
.
encodings
!
.
push
(
encoding
);
consumerParams
.
rtcp
=
consumableParams
.
rtcp
;
}
}
return
consumerParams
;
return
consumerParams
;
}
}
...
...
test/test-Consumer.js
浏览文件 @
6961afb1
...
@@ -13,6 +13,7 @@ let audioProducer;
...
@@ -13,6 +13,7 @@ let audioProducer;
let
videoProducer
;
let
videoProducer
;
let
audioConsumer
;
let
audioConsumer
;
let
videoConsumer
;
let
videoConsumer
;
let
videoPipeConsumer
;
const
mediaCodecs
=
const
mediaCodecs
=
[
[
...
@@ -396,21 +397,90 @@ test('transport.consume() succeeds', async () =>
...
@@ -396,21 +397,90 @@ test('transport.consume() succeeds', async () =>
expect
(
videoConsumer
.
currentLayers
).
toBeUndefined
();
expect
(
videoConsumer
.
currentLayers
).
toBeUndefined
();
expect
(
videoConsumer
.
appData
).
toEqual
({
baz
:
'LOL'
});
expect
(
videoConsumer
.
appData
).
toEqual
({
baz
:
'LOL'
});
await
expect
(
router
.
dump
())
const
onObserverNewConsumer3
=
jest
.
fn
();
.
resolves
.
toMatchObject
(
transport2
.
observer
.
once
(
'newconsumer'
,
onObserverNewConsumer3
);
expect
(
router
.
canConsume
(
{
producerId
:
videoProducer
.
id
,
rtpCapabilities
:
consumerDeviceCapabilities
}))
.
toBe
(
true
);
videoPipeConsumer
=
await
transport2
.
consume
(
{
producerId
:
videoProducer
.
id
,
rtpCapabilities
:
consumerDeviceCapabilities
,
pipe
:
true
});
expect
(
onObserverNewConsumer3
).
toHaveBeenCalledTimes
(
1
);
expect
(
onObserverNewConsumer3
).
toHaveBeenCalledWith
(
videoPipeConsumer
);
expect
(
videoPipeConsumer
.
id
).
toBeType
(
'string'
);
expect
(
videoPipeConsumer
.
producerId
).
toBe
(
videoProducer
.
id
);
expect
(
videoPipeConsumer
.
closed
).
toBe
(
false
);
expect
(
videoPipeConsumer
.
kind
).
toBe
(
'video'
);
expect
(
videoPipeConsumer
.
rtpParameters
).
toBeType
(
'object'
);
expect
(
videoPipeConsumer
.
rtpParameters
.
mid
).
toBeUndefined
();
expect
(
videoPipeConsumer
.
rtpParameters
.
codecs
.
length
).
toBe
(
2
);
expect
(
videoPipeConsumer
.
rtpParameters
.
codecs
[
0
]).
toEqual
(
{
mimeType
:
'video/H264'
,
payloadType
:
103
,
clockRate
:
90000
,
parameters
:
{
{
mapProducerIdConsumerIds
:
'packetization-mode'
:
1
,
{
'profile-level-id'
:
'4d0032'
[
audioProducer
.
id
]
:
[
audioConsumer
.
id
],
},
[
videoProducer
.
id
]
:
[
videoConsumer
.
id
]
rtcpFeedback
:
},
[
mapConsumerIdProducerId
:
{
type
:
'nack'
,
parameter
:
''
},
{
{
type
:
'nack'
,
parameter
:
'pli'
},
[
audioConsumer
.
id
]
:
audioProducer
.
id
,
{
type
:
'ccm'
,
parameter
:
'fir'
},
[
videoConsumer
.
id
]
:
videoProducer
.
id
{
type
:
'goog-remb'
,
parameter
:
''
}
}
]
});
});
expect
(
videoPipeConsumer
.
rtpParameters
.
codecs
[
1
]).
toEqual
(
{
mimeType
:
'video/rtx'
,
payloadType
:
104
,
clockRate
:
90000
,
parameters
:
{
apt
:
103
},
rtcpFeedback
:
[]
});
expect
(
videoPipeConsumer
.
type
).
toBe
(
'pipe'
);
expect
(
videoPipeConsumer
.
paused
).
toBe
(
false
);
expect
(
videoPipeConsumer
.
producerPaused
).
toBe
(
true
);
expect
(
videoPipeConsumer
.
priority
).
toBe
(
1
);
expect
(
videoPipeConsumer
.
score
).
toEqual
(
{
score
:
10
,
producerScore
:
10
,
producerScores
:
[
0
,
0
,
0
,
0
]
});
expect
(
videoPipeConsumer
.
preferredLayers
).
toBeUndefined
();
expect
(
videoPipeConsumer
.
currentLayers
).
toBeUndefined
();
expect
(
videoPipeConsumer
.
appData
).
toBeUndefined
;
const
dump
=
await
router
.
dump
();
for
(
const
key
of
Object
.
keys
(
dump
.
mapProducerIdConsumerIds
))
{
dump
.
mapProducerIdConsumerIds
[
key
]
=
dump
.
mapProducerIdConsumerIds
[
key
].
sort
();
}
expect
(
dump
).
toMatchObject
(
{
mapProducerIdConsumerIds
:
{
[
audioProducer
.
id
]
:
[
audioConsumer
.
id
],
[
videoProducer
.
id
]
:
[
videoConsumer
.
id
,
videoPipeConsumer
.
id
].
sort
()
},
mapConsumerIdProducerId
:
{
[
audioConsumer
.
id
]
:
audioProducer
.
id
,
[
videoConsumer
.
id
]
:
videoProducer
.
id
,
[
videoPipeConsumer
.
id
]
:
videoProducer
.
id
}
});
await
expect
(
transport2
.
dump
())
await
expect
(
transport2
.
dump
())
.
resolves
.
resolves
...
@@ -418,7 +488,12 @@ test('transport.consume() succeeds', async () =>
...
@@ -418,7 +488,12 @@ test('transport.consume() succeeds', async () =>
{
{
id
:
transport2
.
id
,
id
:
transport2
.
id
,
producerIds
:
[],
producerIds
:
[],
consumerIds
:
expect
.
arrayContaining
([
audioConsumer
.
id
,
videoConsumer
.
id
])
consumerIds
:
expect
.
arrayContaining
(
[
audioConsumer
.
id
,
videoConsumer
.
id
,
videoPipeConsumer
.
id
])
});
});
},
2000
);
},
2000
);
...
@@ -822,13 +897,16 @@ test('consumer.close() succeeds', async () =>
...
@@ -822,13 +897,16 @@ test('consumer.close() succeeds', async () =>
mapConsumerIdProducerId
:
{}
mapConsumerIdProducerId
:
{}
});
});
await
expect
(
transport2
.
dump
())
const
dump
=
await
transport2
.
dump
();
.
resolves
dump
.
consumerIds
=
dump
.
consumerIds
.
sort
();
expect
(
dump
)
.
toMatchObject
(
.
toMatchObject
(
{
{
id
:
transport2
.
id
,
id
:
transport2
.
id
,
producerIds
:
[],
producerIds
:
[],
consumerIds
:
[
videoConsumer
.
id
]
consumerIds
:
[
videoConsumer
.
id
,
videoPipeConsumer
.
id
].
sort
()
});
});
},
2000
);
},
2000
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论