Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
a16f047e
Unverified
提交
a16f047e
authored
6月 25, 2024
作者:
DavidNegro
提交者:
GitHub
6月 25, 2024
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add support for playout-delay extension (#1412)
上级
e88517de
显示空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
184 行增加
和
2 行删除
+184
-2
RtpParameters.ts
node/src/RtpParameters.ts
+10
-1
supportedRtpCapabilities.ts
node/src/supportedRtpCapabilities.ts
+14
-0
test-PipeTransport.ts
node/src/test/test-PipeTransport.ts
+30
-0
rtp_parameters.rs
rust/src/rtp_parameters.rs
+14
-0
supported_rtp_capabilities.rs
rust/src/supported_rtp_capabilities.rs
+14
-0
pipe_transport.rs
rust/tests/integration/pipe_transport.rs
+26
-1
rtpParameters.fbs
worker/fbs/rtpParameters.fbs
+1
-0
RtpDictionaries.hpp
worker/include/RTC/RtpDictionaries.hpp
+1
-0
RtpHeaderExtensionIds.hpp
worker/include/RTC/RtpHeaderExtensionIds.hpp
+1
-0
RtpPacket.hpp
worker/include/RTC/RtpPacket.hpp
+22
-0
Consumer.cpp
worker/src/RTC/Consumer.cpp
+5
-0
Producer.cpp
worker/src/RTC/Producer.cpp
+20
-0
RtpHeaderExtensionUri.cpp
worker/src/RTC/RtpDictionaries/RtpHeaderExtensionUri.cpp
+10
-0
RtpPacket.cpp
worker/src/RTC/RtpPacket.cpp
+16
-0
没有找到文件。
node/src/RtpParameters.ts
浏览文件 @
a16f047e
...
...
@@ -321,7 +321,8 @@ export type RtpHeaderExtensionUri =
|
'urn:ietf:params:rtp-hdrext:toffset'
|
'http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01'
|
'http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time'
|
'http://www.webrtc.org/experiments/rtp-hdrext/abs-capture-time'
;
|
'http://www.webrtc.org/experiments/rtp-hdrext/abs-capture-time'
|
'http://www.webrtc.org/experiments/rtp-hdrext/playout-delay'
;
/**
* Defines a RTP header extension within the RTP parameters. The list of RTP
...
...
@@ -758,6 +759,10 @@ export function rtpHeaderExtensionUriFromFbs(
case
FbsRtpHeaderExtensionUri
.
AbsCaptureTime
:
{
return
'http://www.webrtc.org/experiments/rtp-hdrext/abs-capture-time'
;
}
case
FbsRtpHeaderExtensionUri
.
PlayoutDelay
:
{
return
'http://www.webrtc.org/experiments/rtp-hdrext/playout-delay'
;
}
}
}
...
...
@@ -809,6 +814,10 @@ export function rtpHeaderExtensionUriToFbs(
return
FbsRtpHeaderExtensionUri
.
AbsCaptureTime
;
}
case
'http://www.webrtc.org/experiments/rtp-hdrext/playout-delay'
:
{
return
FbsRtpHeaderExtensionUri
.
PlayoutDelay
;
}
default
:
{
throw
new
TypeError
(
`invalid RtpHeaderExtensionUri:
${
uri
}
`
);
}
...
...
node/src/supportedRtpCapabilities.ts
浏览文件 @
a16f047e
...
...
@@ -328,6 +328,20 @@ const supportedRtpCapabilities: RtpCapabilities = {
preferredEncrypt
:
false
,
direction
:
'sendrecv'
,
},
{
kind
:
'audio'
,
uri
:
'http://www.webrtc.org/experiments/rtp-hdrext/playout-delay'
,
preferredId
:
14
,
preferredEncrypt
:
false
,
direction
:
'sendrecv'
,
},
{
kind
:
'video'
,
uri
:
'http://www.webrtc.org/experiments/rtp-hdrext/playout-delay'
,
preferredId
:
14
,
preferredEncrypt
:
false
,
direction
:
'sendrecv'
,
},
],
};
...
...
node/src/test/test-PipeTransport.ts
浏览文件 @
a16f047e
...
...
@@ -271,6 +271,12 @@ test('router.pipeToRouter() succeeds with audio', async () => {
encrypt
:
false
,
parameters
:
{},
},
{
uri
:
'http://www.webrtc.org/experiments/rtp-hdrext/playout-delay'
,
id
:
14
,
encrypt
:
false
,
parameters
:
{},
},
]);
expect
(
pipeConsumer
.
type
).
toBe
(
'pipe'
);
expect
(
pipeConsumer
.
paused
).
toBe
(
false
);
...
...
@@ -313,6 +319,12 @@ test('router.pipeToRouter() succeeds with audio', async () => {
encrypt
:
false
,
parameters
:
{},
},
{
uri
:
'http://www.webrtc.org/experiments/rtp-hdrext/playout-delay'
,
id
:
14
,
encrypt
:
false
,
parameters
:
{},
},
]);
expect
(
pipeProducer
.
paused
).
toBe
(
false
);
},
2000
);
...
...
@@ -387,6 +399,12 @@ test('router.pipeToRouter() succeeds with video', async () => {
encrypt
:
false
,
parameters
:
{},
},
{
uri
:
'http://www.webrtc.org/experiments/rtp-hdrext/playout-delay'
,
id
:
14
,
encrypt
:
false
,
parameters
:
{},
},
]);
expect
(
pipeConsumer
.
type
).
toBe
(
'pipe'
);
...
...
@@ -448,6 +466,12 @@ test('router.pipeToRouter() succeeds with video', async () => {
encrypt
:
false
,
parameters
:
{},
},
{
uri
:
'http://www.webrtc.org/experiments/rtp-hdrext/playout-delay'
,
id
:
14
,
encrypt
:
false
,
parameters
:
{},
},
]);
expect
(
pipeProducer
.
paused
).
toBe
(
true
);
},
2000
);
...
...
@@ -561,6 +585,12 @@ test('router.createPipeTransport() with enableRtx succeeds', async () => {
encrypt
:
false
,
parameters
:
{},
},
{
uri
:
'http://www.webrtc.org/experiments/rtp-hdrext/playout-delay'
,
id
:
14
,
encrypt
:
false
,
parameters
:
{},
},
]);
expect
(
pipeConsumer
.
type
).
toBe
(
'pipe'
);
...
...
rust/src/rtp_parameters.rs
浏览文件 @
a16f047e
...
...
@@ -585,6 +585,10 @@ pub enum RtpHeaderExtensionUri {
/// <http://www.webrtc.org/experiments/rtp-hdrext/abs-capture-time>
#[serde(rename
=
"http://www.webrtc.org/experiments/rtp-hdrext/abs-capture-time"
)]
AbsCaptureTime
,
/// <http://www.webrtc.org/experiments/rtp-hdrext/playout-delay>
#[serde(rename
=
"http://www.webrtc.org/experiments/rtp-hdrext/playout-delay"
)]
PlayoutDelay
,
#[doc(hidden)]
#[serde(other,
rename
=
"unsupported"
)]
Unsupported
,
...
...
@@ -620,6 +624,9 @@ impl RtpHeaderExtensionUri {
RtpHeaderExtensionUri
::
AbsCaptureTime
=>
{
rtp_parameters
::
RtpHeaderExtensionUri
::
AbsCaptureTime
}
RtpHeaderExtensionUri
::
PlayoutDelay
=>
{
rtp_parameters
::
RtpHeaderExtensionUri
::
PlayoutDelay
}
RtpHeaderExtensionUri
::
Unsupported
=>
panic!
(
"Invalid RTP extension header URI"
),
}
}
...
...
@@ -653,6 +660,9 @@ impl RtpHeaderExtensionUri {
rtp_parameters
::
RtpHeaderExtensionUri
::
AbsCaptureTime
=>
{
RtpHeaderExtensionUri
::
AbsCaptureTime
}
rtp_parameters
::
RtpHeaderExtensionUri
::
PlayoutDelay
=>
{
RtpHeaderExtensionUri
::
PlayoutDelay
}
}
}
}
...
...
@@ -679,6 +689,7 @@ impl FromStr for RtpHeaderExtensionUri {
"http://www.webrtc.org/experiments/rtp-hdrext/abs-capture-time"
=>
{
Ok
(
Self
::
AbsCaptureTime
)
}
"http://www.webrtc.org/experiments/rtp-hdrext/playout-delay"
=>
Ok
(
Self
::
PlayoutDelay
),
_
=>
Err
(
RtpHeaderExtensionUriParseError
::
Unsupported
),
}
}
...
...
@@ -710,6 +721,9 @@ impl RtpHeaderExtensionUri {
RtpHeaderExtensionUri
::
AbsCaptureTime
=>
{
"http://www.webrtc.org/experiments/rtp-hdrext/abs-capture-time"
}
RtpHeaderExtensionUri
::
PlayoutDelay
=>
{
"http://www.webrtc.org/experiments/rtp-hdrext/playout-delay"
}
RtpHeaderExtensionUri
::
Unsupported
=>
"unsupported"
,
}
}
...
...
rust/src/supported_rtp_capabilities.rs
浏览文件 @
a16f047e
...
...
@@ -386,6 +386,20 @@ pub fn get_supported_rtp_capabilities() -> RtpCapabilities {
preferred_encrypt
:
false
,
direction
:
RtpHeaderExtensionDirection
::
SendRecv
,
},
RtpHeaderExtension
{
kind
:
MediaKind
::
Audio
,
uri
:
RtpHeaderExtensionUri
::
PlayoutDelay
,
preferred_id
:
14
,
preferred_encrypt
:
false
,
direction
:
RtpHeaderExtensionDirection
::
SendRecv
,
},
RtpHeaderExtension
{
kind
:
MediaKind
::
Video
,
uri
:
RtpHeaderExtensionUri
::
PlayoutDelay
,
preferred_id
:
14
,
preferred_encrypt
:
false
,
direction
:
RtpHeaderExtensionDirection
::
SendRecv
,
},
],
}
}
rust/tests/integration/pipe_transport.rs
浏览文件 @
a16f047e
...
...
@@ -350,6 +350,11 @@ fn pipe_to_router_succeeds_with_audio() {
uri
:
RtpHeaderExtensionUri
::
AbsCaptureTime
,
id
:
13
,
encrypt
:
false
,
},
RtpHeaderExtensionParameters
{
uri
:
RtpHeaderExtensionUri
::
PlayoutDelay
,
id
:
14
,
encrypt
:
false
,
}
],
);
...
...
@@ -395,7 +400,12 @@ fn pipe_to_router_succeeds_with_audio() {
uri
:
RtpHeaderExtensionUri
::
AbsCaptureTime
,
id
:
13
,
encrypt
:
false
,
}
},
RtpHeaderExtensionParameters
{
uri
:
RtpHeaderExtensionUri
::
PlayoutDelay
,
id
:
14
,
encrypt
:
false
,
},
],
);
assert
!
(
!
pipe_producer
.paused
());
...
...
@@ -499,6 +509,11 @@ fn pipe_to_router_succeeds_with_video() {
id
:
13
,
encrypt
:
false
,
},
RtpHeaderExtensionParameters
{
uri
:
RtpHeaderExtensionUri
::
PlayoutDelay
,
id
:
14
,
encrypt
:
false
,
},
],
);
assert_eq!
(
pipe_consumer
.r
#
type
(),
ConsumerType
::
Pipe
);
...
...
@@ -556,6 +571,11 @@ fn pipe_to_router_succeeds_with_video() {
id
:
13
,
encrypt
:
false
,
},
RtpHeaderExtensionParameters
{
uri
:
RtpHeaderExtensionUri
::
PlayoutDelay
,
id
:
14
,
encrypt
:
false
,
},
],
);
assert
!
(
pipe_producer
.paused
());
...
...
@@ -753,6 +773,11 @@ fn create_with_enable_rtx_succeeds() {
id
:
13
,
encrypt
:
false
,
},
RtpHeaderExtensionParameters
{
uri
:
RtpHeaderExtensionUri
::
PlayoutDelay
,
id
:
14
,
encrypt
:
false
,
},
],
);
assert_eq!
(
pipe_consumer
.r
#
type
(),
ConsumerType
::
Pipe
);
...
...
worker/fbs/rtpParameters.fbs
浏览文件 @
a16f047e
...
...
@@ -73,6 +73,7 @@ enum RtpHeaderExtensionUri: uint8 {
TransportWideCcDraft01,
AbsSendTime,
AbsCaptureTime,
PlayoutDelay,
}
table RtpHeaderExtensionParameters {
...
...
worker/include/RTC/RtpDictionaries.hpp
浏览文件 @
a16f047e
...
...
@@ -127,6 +127,7 @@ namespace RTC
VIDEO_ORIENTATION
=
11
,
TOFFSET
=
12
,
ABS_CAPTURE_TIME
=
13
,
PLAYOUT_DELAY
=
14
,
};
public
:
...
...
worker/include/RTC/RtpHeaderExtensionIds.hpp
浏览文件 @
a16f047e
...
...
@@ -19,6 +19,7 @@ namespace RTC
uint8_t
videoOrientation
{
0u
};
uint8_t
toffset
{
0u
};
uint8_t
absCaptureTime
{
0u
};
uint8_t
playoutDelay
{
0u
};
};
}
// namespace RTC
...
...
worker/include/RTC/RtpPacket.hpp
浏览文件 @
a16f047e
...
...
@@ -309,6 +309,11 @@ namespace RTC
this
->
videoOrientationExtensionId
=
id
;
}
void
SetPlayoutDelayExtensionId
(
uint8_t
id
)
{
this
->
playoutDelayExtensionId
=
id
;
}
bool
ReadMid
(
std
::
string
&
mid
)
const
{
uint8_t
extenLen
;
...
...
@@ -489,6 +494,22 @@ namespace RTC
return
true
;
}
bool
ReadPlayoutDelay
(
uint16_t
&
minDelay
,
uint16_t
&
maxDelay
)
const
{
uint8_t
extenLen
;
uint8_t
*
extenValue
=
GetExtension
(
this
->
playoutDelayExtensionId
,
extenLen
);
if
(
extenLen
!=
3
)
{
return
false
;
}
uint32_t
v
=
Utils
::
Byte
::
Get3Bytes
(
extenValue
,
0
);
minDelay
=
v
>>
12u
;
maxDelay
=
v
&
0xFFFu
;
return
true
;
}
bool
HasExtension
(
uint8_t
id
)
const
{
if
(
id
==
0u
)
...
...
@@ -672,6 +693,7 @@ namespace RTC
uint8_t
frameMarkingExtensionId
{
0u
};
uint8_t
ssrcAudioLevelExtensionId
{
0u
};
uint8_t
videoOrientationExtensionId
{
0u
};
uint8_t
playoutDelayExtensionId
{
0u
};
uint8_t
*
payload
{
nullptr
};
size_t
payloadLength
{
0u
};
uint8_t
payloadPadding
{
0u
};
...
...
worker/src/RTC/Consumer.cpp
浏览文件 @
a16f047e
...
...
@@ -85,6 +85,11 @@ namespace RTC
this
->
rtpHeaderExtensionIds
.
videoOrientation
=
exten
.
id
;
}
if
(
this
->
rtpHeaderExtensionIds
.
playoutDelay
==
0u
&&
exten
.
type
==
RTC
::
RtpHeaderExtensionUri
::
Type
::
PLAYOUT_DELAY
)
{
this
->
rtpHeaderExtensionIds
.
playoutDelay
=
exten
.
id
;
}
if
(
this
->
rtpHeaderExtensionIds
.
absSendTime
==
0u
&&
exten
.
type
==
RTC
::
RtpHeaderExtensionUri
::
Type
::
ABS_SEND_TIME
)
{
this
->
rtpHeaderExtensionIds
.
absSendTime
=
exten
.
id
;
...
...
worker/src/RTC/Producer.cpp
浏览文件 @
a16f047e
...
...
@@ -192,6 +192,11 @@ namespace RTC
{
this
->
rtpHeaderExtensionIds
.
absCaptureTime
=
exten
.
id
;
}
if
(
this
->
rtpHeaderExtensionIds
.
playoutDelay
==
0u
&&
exten
.
type
==
RTC
::
RtpHeaderExtensionUri
::
Type
::
PLAYOUT_DELAY
)
{
this
->
rtpHeaderExtensionIds
.
playoutDelay
=
exten
.
id
;
}
}
// Set the RTCP report generation interval.
...
...
@@ -1264,6 +1269,19 @@ namespace RTC
bufferPtr
+=
extenLen
;
}
// Proxy http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
extenValue
=
packet
->
GetExtension
(
this
->
rtpHeaderExtensionIds
.
playoutDelay
,
extenLen
);
if
(
extenValue
)
{
std
::
memcpy
(
bufferPtr
,
extenValue
,
extenLen
);
extensions
.
emplace_back
(
static_cast
<
uint8_t
>
(
RTC
::
RtpHeaderExtensionUri
::
Type
::
PLAYOUT_DELAY
),
extenLen
,
bufferPtr
);
bufferPtr
+=
extenLen
;
}
if
(
this
->
kind
==
RTC
::
Media
::
Kind
::
AUDIO
)
{
// Proxy urn:ietf:params:rtp-hdrext:ssrc-audio-level.
...
...
@@ -1396,6 +1414,8 @@ namespace RTC
static_cast
<
uint8_t
>
(
RTC
::
RtpHeaderExtensionUri
::
Type
::
SSRC_AUDIO_LEVEL
));
packet
->
SetVideoOrientationExtensionId
(
static_cast
<
uint8_t
>
(
RTC
::
RtpHeaderExtensionUri
::
Type
::
VIDEO_ORIENTATION
));
packet
->
SetPlayoutDelayExtensionId
(
static_cast
<
uint8_t
>
(
RTC
::
RtpHeaderExtensionUri
::
Type
::
PLAYOUT_DELAY
));
}
return
true
;
...
...
worker/src/RTC/RtpDictionaries/RtpHeaderExtensionUri.cpp
浏览文件 @
a16f047e
...
...
@@ -48,6 +48,11 @@ namespace RTC
return
RtpHeaderExtensionUri
::
Type
::
VIDEO_ORIENTATION
;
}
case
FBS
:
:
RtpParameters
::
RtpHeaderExtensionUri
::
PlayoutDelay
:
{
return
RtpHeaderExtensionUri
::
Type
::
PLAYOUT_DELAY
;
}
case
FBS
:
:
RtpParameters
::
RtpHeaderExtensionUri
::
TimeOffset
:
{
return
RtpHeaderExtensionUri
::
Type
::
TOFFSET
;
...
...
@@ -120,6 +125,11 @@ namespace RTC
return
FBS
::
RtpParameters
::
RtpHeaderExtensionUri
::
VideoOrientation
;
}
case
RtpHeaderExtensionUri
:
:
Type
::
PLAYOUT_DELAY
:
{
return
FBS
::
RtpParameters
::
RtpHeaderExtensionUri
::
PlayoutDelay
;
}
case
RtpHeaderExtensionUri
:
:
Type
::
TOFFSET
:
{
return
FBS
::
RtpParameters
::
RtpHeaderExtensionUri
::
TimeOffset
;
...
...
worker/src/RTC/RtpPacket.cpp
浏览文件 @
a16f047e
...
...
@@ -300,6 +300,20 @@ namespace RTC
rotation
);
}
}
if
(
this
->
playoutDelayExtensionId
!=
0u
)
{
uint16_t
minDelay
;
uint16_t
maxDelay
;
if
(
ReadPlayoutDelay
(
minDelay
,
maxDelay
))
{
MS_DUMP
(
" playoutDelay: extId:%"
PRIu8
", minDelay:%"
PRIu16
", maxDelay:%"
PRIu16
,
this
->
videoOrientationExtensionId
,
minDelay
,
maxDelay
);
}
}
MS_DUMP
(
" csrc count: %"
PRIu8
,
this
->
header
->
csrcCount
);
MS_DUMP
(
" marker: %s"
,
HasMarker
()
?
"true"
:
"false"
);
MS_DUMP
(
" payload type: %"
PRIu8
,
GetPayloadType
());
...
...
@@ -387,6 +401,7 @@ namespace RTC
this
->
frameMarkingExtensionId
=
0u
;
this
->
ssrcAudioLevelExtensionId
=
0u
;
this
->
videoOrientationExtensionId
=
0u
;
this
->
playoutDelayExtensionId
=
0u
;
// Clear the One-Byte and Two-Bytes extension elements maps.
std
::
fill
(
std
::
begin
(
this
->
oneByteExtensions
),
std
::
end
(
this
->
oneByteExtensions
),
nullptr
);
...
...
@@ -748,6 +763,7 @@ namespace RTC
packet
->
frameMarkingExtensionId
=
this
->
frameMarkingExtensionId
;
packet
->
ssrcAudioLevelExtensionId
=
this
->
ssrcAudioLevelExtensionId
;
packet
->
videoOrientationExtensionId
=
this
->
videoOrientationExtensionId
;
packet
->
playoutDelayExtensionId
=
this
->
playoutDelayExtensionId
;
// Assign the payload descriptor handler.
packet
->
payloadDescriptorHandler
=
this
->
payloadDescriptorHandler
;
// Store allocated buffer.
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论