Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
87032a8b
Unverified
提交
87032a8b
authored
1月 03, 2024
作者:
GithubUser8080
提交者:
GitHub
1月 03, 2024
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add sender report trace event (#1267)
上级
ddcd72f1
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
122 行增加
和
3 行删除
+122
-3
Producer.ts
node/src/Producer.ts
+11
-1
data_structures.rs
rust/src/data_structures.rs
+34
-1
producer.rs
rust/src/router/producer.rs
+27
-1
producer.fbs
worker/fbs/producer.fbs
+11
-0
Producer.hpp
worker/include/RTC/Producer.hpp
+2
-0
Producer.cpp
worker/src/RTC/Producer.cpp
+37
-0
没有找到文件。
node/src/Producer.ts
浏览文件 @
87032a8b
...
@@ -52,7 +52,7 @@ export type ProducerOptions<ProducerAppData extends AppData = AppData> =
...
@@ -52,7 +52,7 @@ export type ProducerOptions<ProducerAppData extends AppData = AppData> =
/**
/**
* Valid types for 'trace' event.
* Valid types for 'trace' event.
*/
*/
export
type
ProducerTraceEventType
=
'rtp'
|
'keyframe'
|
'nack'
|
'pli'
|
'fir'
;
export
type
ProducerTraceEventType
=
'rtp'
|
'keyframe'
|
'nack'
|
'pli'
|
'fir'
|
'sr'
;
/**
/**
* 'trace' event data.
* 'trace' event data.
...
@@ -702,6 +702,11 @@ function producerTraceEventTypeToFbs(eventType: ProducerTraceEventType)
...
@@ -702,6 +702,11 @@ function producerTraceEventTypeToFbs(eventType: ProducerTraceEventType)
return
FbsProducer
.
TraceEventType
.
RTP
;
return
FbsProducer
.
TraceEventType
.
RTP
;
}
}
case
'sr'
:
{
return
FbsProducer
.
TraceEventType
.
SR
;
}
default
:
default
:
{
{
throw
new
TypeError
(
`invalid ProducerTraceEventType:
${
eventType
}
`
);
throw
new
TypeError
(
`invalid ProducerTraceEventType:
${
eventType
}
`
);
...
@@ -738,6 +743,11 @@ function producerTraceEventTypeFromFbs(eventType: FbsProducer.TraceEventType)
...
@@ -738,6 +743,11 @@ function producerTraceEventTypeFromFbs(eventType: FbsProducer.TraceEventType)
{
{
return
'rtp'
;
return
'rtp'
;
}
}
case
FbsProducer
.
TraceEventType
.
SR
:
{
return
'sr'
;
}
}
}
}
}
...
...
rust/src/data_structures.rs
浏览文件 @
87032a8b
...
@@ -3,7 +3,9 @@
...
@@ -3,7 +3,9 @@
#[cfg(test)]
#[cfg(test)]
mod
tests
;
mod
tests
;
use
mediasoup_sys
::
fbs
::{
common
,
rtp_packet
,
sctp_association
,
transport
,
web_rtc_transport
};
use
mediasoup_sys
::
fbs
::{
common
,
producer
,
rtp_packet
,
sctp_association
,
transport
,
web_rtc_transport
,
};
use
serde
::
de
::{
MapAccess
,
Visitor
};
use
serde
::
de
::{
MapAccess
,
Visitor
};
use
serde
::
ser
::
SerializeStruct
;
use
serde
::
ser
::
SerializeStruct
;
use
serde
::{
de
,
Deserialize
,
Deserializer
,
Serialize
,
Serializer
};
use
serde
::{
de
,
Deserialize
,
Deserializer
,
Serialize
,
Serializer
};
...
@@ -1262,3 +1264,34 @@ impl BweTraceInfo {
...
@@ -1262,3 +1264,34 @@ impl BweTraceInfo {
}
}
}
}
}
}
/// BWE info in trace event.
#[derive(Debug,
Copy,
Clone,
Deserialize,
Serialize)]
#[serde(rename_all
=
"camelCase"
)]
pub
struct
SrTraceInfo
{
/// Stream SSRC
ssrc
:
u32
,
/// NTP : most significant word
ntp_sec
:
u32
,
/// NTP : least significant word
ntp_frac
:
u32
,
/// RTP timestamp
rtp_ts
:
u32
,
/// Sender packet count
packet_count
:
u32
,
/// Sender octet count
octet_count
:
u32
,
}
impl
SrTraceInfo
{
pub
(
crate
)
fn
from_fbs
(
info
:
producer
::
SrTraceInfo
)
->
Self
{
Self
{
ssrc
:
info
.ssrc
,
ntp_sec
:
info
.ntp_sec
,
ntp_frac
:
info
.ntp_frac
,
rtp_ts
:
info
.rtp_ts
,
packet_count
:
info
.packet_count
,
octet_count
:
info
.octet_count
,
}
}
}
rust/src/router/producer.rs
浏览文件 @
87032a8b
...
@@ -2,7 +2,9 @@
...
@@ -2,7 +2,9 @@
mod
tests
;
mod
tests
;
use
crate
::
consumer
::{
RtpStreamParams
,
RtxStreamParams
};
use
crate
::
consumer
::{
RtpStreamParams
,
RtxStreamParams
};
use
crate
::
data_structures
::{
AppData
,
RtpPacketTraceInfo
,
SsrcTraceInfo
,
TraceEventDirection
};
use
crate
::
data_structures
::{
AppData
,
RtpPacketTraceInfo
,
SrTraceInfo
,
SsrcTraceInfo
,
TraceEventDirection
,
};
use
crate
::
messages
::{
use
crate
::
messages
::{
ProducerCloseRequest
,
ProducerDumpRequest
,
ProducerEnableTraceEventRequest
,
ProducerCloseRequest
,
ProducerDumpRequest
,
ProducerEnableTraceEventRequest
,
ProducerGetStatsRequest
,
ProducerPauseRequest
,
ProducerResumeRequest
,
ProducerSendNotification
,
ProducerGetStatsRequest
,
ProducerPauseRequest
,
ProducerResumeRequest
,
ProducerSendNotification
,
...
@@ -394,6 +396,15 @@ pub enum ProducerTraceEventData {
...
@@ -394,6 +396,15 @@ pub enum ProducerTraceEventData {
/// SSRC info.
/// SSRC info.
info
:
SsrcTraceInfo
,
info
:
SsrcTraceInfo
,
},
},
/// RTCP Sender report.
Sr
{
/// Event timestamp.
timestamp
:
u64
,
/// Event direction.
direction
:
TraceEventDirection
,
/// SSRC info.
info
:
SrTraceInfo
,
},
}
}
impl
ProducerTraceEventData
{
impl
ProducerTraceEventData
{
...
@@ -447,6 +458,17 @@ impl ProducerTraceEventData {
...
@@ -447,6 +458,17 @@ impl ProducerTraceEventData {
SsrcTraceInfo
{
ssrc
:
info
.ssrc
}
SsrcTraceInfo
{
ssrc
:
info
.ssrc
}
},
},
},
},
producer
::
TraceEventType
::
Sr
=>
ProducerTraceEventData
::
Sr
{
timestamp
:
data
.timestamp
,
direction
:
TraceEventDirection
::
from_fbs
(
data
.direction
),
info
:
{
let
Some
(
producer
::
TraceInfo
::
SrTraceInfo
(
info
))
=
data
.info
else
{
panic!
(
"Wrong message from worker: {data:?}"
);
};
SrTraceInfo
::
from_fbs
(
*
info
)
},
},
}
}
}
}
}
}
...
@@ -465,6 +487,8 @@ pub enum ProducerTraceEventType {
...
@@ -465,6 +487,8 @@ pub enum ProducerTraceEventType {
Pli
,
Pli
,
/// RTCP FIR packet.
/// RTCP FIR packet.
Fir
,
Fir
,
/// RTCP Sender report.
SR
,
}
}
impl
ProducerTraceEventType
{
impl
ProducerTraceEventType
{
...
@@ -475,6 +499,7 @@ impl ProducerTraceEventType {
...
@@ -475,6 +499,7 @@ impl ProducerTraceEventType {
ProducerTraceEventType
::
Nack
=>
producer
::
TraceEventType
::
Nack
,
ProducerTraceEventType
::
Nack
=>
producer
::
TraceEventType
::
Nack
,
ProducerTraceEventType
::
Pli
=>
producer
::
TraceEventType
::
Pli
,
ProducerTraceEventType
::
Pli
=>
producer
::
TraceEventType
::
Pli
,
ProducerTraceEventType
::
Fir
=>
producer
::
TraceEventType
::
Fir
,
ProducerTraceEventType
::
Fir
=>
producer
::
TraceEventType
::
Fir
,
ProducerTraceEventType
::
SR
=>
producer
::
TraceEventType
::
Sr
,
}
}
}
}
...
@@ -485,6 +510,7 @@ impl ProducerTraceEventType {
...
@@ -485,6 +510,7 @@ impl ProducerTraceEventType {
producer
::
TraceEventType
::
Nack
=>
ProducerTraceEventType
::
Nack
,
producer
::
TraceEventType
::
Nack
=>
ProducerTraceEventType
::
Nack
,
producer
::
TraceEventType
::
Pli
=>
ProducerTraceEventType
::
Pli
,
producer
::
TraceEventType
::
Pli
=>
ProducerTraceEventType
::
Pli
,
producer
::
TraceEventType
::
Fir
=>
ProducerTraceEventType
::
Fir
,
producer
::
TraceEventType
::
Fir
=>
ProducerTraceEventType
::
Fir
,
producer
::
TraceEventType
::
Sr
=>
ProducerTraceEventType
::
SR
,
}
}
}
}
}
}
...
...
worker/fbs/producer.fbs
浏览文件 @
87032a8b
...
@@ -11,6 +11,7 @@ enum TraceEventType: uint8 {
...
@@ -11,6 +11,7 @@ enum TraceEventType: uint8 {
NACK,
NACK,
PLI,
PLI,
RTP,
RTP,
SR,
}
}
table EnableTraceEventRequest {
table EnableTraceEventRequest {
...
@@ -60,6 +61,7 @@ union TraceInfo {
...
@@ -60,6 +61,7 @@ union TraceInfo {
FirTraceInfo,
FirTraceInfo,
PliTraceInfo,
PliTraceInfo,
RtpTraceInfo,
RtpTraceInfo,
SrTraceInfo,
}
}
table KeyFrameTraceInfo {
table KeyFrameTraceInfo {
...
@@ -80,6 +82,15 @@ table RtpTraceInfo {
...
@@ -80,6 +82,15 @@ table RtpTraceInfo {
is_rtx: bool;
is_rtx: bool;
}
}
table SrTraceInfo {
ssrc: uint32;
ntp_sec: uint32;
ntp_frac: uint32;
rtp_ts: uint32;
packet_count: uint32;
octet_count: uint32;
}
table TraceNotification {
table TraceNotification {
type: TraceEventType;
type: TraceEventType;
timestamp: uint64;
timestamp: uint64;
...
...
worker/include/RTC/Producer.hpp
浏览文件 @
87032a8b
...
@@ -89,6 +89,7 @@ namespace RTC
...
@@ -89,6 +89,7 @@ namespace RTC
bool
nack
{
false
};
bool
nack
{
false
};
bool
pli
{
false
};
bool
pli
{
false
};
bool
fir
{
false
};
bool
fir
{
false
};
bool
sr
{
false
};
};
};
public
:
public
:
...
@@ -160,6 +161,7 @@ namespace RTC
...
@@ -160,6 +161,7 @@ namespace RTC
void
EmitTraceEventPliType
(
uint32_t
ssrc
)
const
;
void
EmitTraceEventPliType
(
uint32_t
ssrc
)
const
;
void
EmitTraceEventFirType
(
uint32_t
ssrc
)
const
;
void
EmitTraceEventFirType
(
uint32_t
ssrc
)
const
;
void
EmitTraceEventNackType
()
const
;
void
EmitTraceEventNackType
()
const
;
void
EmitTraceEventSrType
(
RTC
::
RTCP
::
SenderReport
*
report
)
const
;
void
EmitTraceEvent
(
flatbuffers
::
Offset
<
FBS
::
Producer
::
TraceNotification
>&
notification
)
const
;
void
EmitTraceEvent
(
flatbuffers
::
Offset
<
FBS
::
Producer
::
TraceNotification
>&
notification
)
const
;
/* Pure virtual methods inherited from RTC::RtpStreamRecv::Listener. */
/* Pure virtual methods inherited from RTC::RtpStreamRecv::Listener. */
...
...
worker/src/RTC/Producer.cpp
浏览文件 @
87032a8b
...
@@ -486,6 +486,12 @@ namespace RTC
...
@@ -486,6 +486,12 @@ namespace RTC
{
{
newTraceEventTypes
.
rtp
=
true
;
newTraceEventTypes
.
rtp
=
true
;
break
;
}
case
FBS
:
:
Producer
::
TraceEventType
::
SR
:
{
newTraceEventTypes
.
sr
=
true
;
break
;
break
;
}
}
}
}
...
@@ -706,6 +712,8 @@ namespace RTC
...
@@ -706,6 +712,8 @@ namespace RTC
this
->
listener
->
OnProducerRtcpSenderReport
(
this
,
rtpStream
,
first
);
this
->
listener
->
OnProducerRtcpSenderReport
(
this
,
rtpStream
,
first
);
EmitTraceEventSrType
(
report
);
return
;
return
;
}
}
...
@@ -1576,6 +1584,35 @@ namespace RTC
...
@@ -1576,6 +1584,35 @@ namespace RTC
EmitTraceEvent
(
notification
);
EmitTraceEvent
(
notification
);
}
}
inline
void
Producer
::
EmitTraceEventSrType
(
RTC
::
RTCP
::
SenderReport
*
report
)
const
{
MS_TRACE
();
if
(
!
this
->
traceEventTypes
.
sr
)
{
return
;
}
auto
traceInfo
=
FBS
::
Producer
::
CreateSrTraceInfo
(
this
->
shared
->
channelNotifier
->
GetBufferBuilder
(),
report
->
GetSsrc
(),
report
->
GetNtpSec
(),
report
->
GetNtpFrac
(),
report
->
GetRtpTs
(),
report
->
GetPacketCount
(),
report
->
GetOctetCount
());
auto
notification
=
FBS
::
Producer
::
CreateTraceNotification
(
this
->
shared
->
channelNotifier
->
GetBufferBuilder
(),
FBS
::
Producer
::
TraceEventType
::
SR
,
DepLibUV
::
GetTimeMs
(),
FBS
::
Common
::
TraceDirection
::
DIRECTION_IN
,
FBS
::
Producer
::
TraceInfo
::
SrTraceInfo
,
traceInfo
.
Union
());
EmitTraceEvent
(
notification
);
}
inline
void
Producer
::
EmitTraceEvent
(
inline
void
Producer
::
EmitTraceEvent
(
flatbuffers
::
Offset
<
FBS
::
Producer
::
TraceNotification
>&
notification
)
const
flatbuffers
::
Offset
<
FBS
::
Producer
::
TraceNotification
>&
notification
)
const
{
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论