Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
735bab66
提交
735bab66
authored
4月 15, 2019
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
- RtpStream: s/GetRate/GetBitrate/g
- RtpStreamRecv: fix GetLayerBitrate() - RtpStreamRecv: add "bitrateByLayer" in stats
上级
b77c933f
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
61 行增加
和
20 行删除
+61
-20
RtpDataCounter.hpp
worker/include/RTC/RtpDataCounter.hpp
+2
-2
RtpStreamRecv.hpp
worker/include/RTC/RtpStreamRecv.hpp
+6
-7
RtpStreamSend.hpp
worker/include/RTC/RtpStreamSend.hpp
+1
-1
RembClient.cpp
worker/src/RTC/RembClient.cpp
+1
-1
RtpStreamRecv.cpp
worker/src/RTC/RtpStreamRecv.cpp
+23
-8
RtpStreamSend.cpp
worker/src/RTC/RtpStreamSend.cpp
+1
-1
SimulcastConsumer.cpp
worker/src/RTC/SimulcastConsumer.cpp
+27
-0
没有找到文件。
worker/include/RTC/RtpDataCounter.hpp
浏览文件 @
735bab66
...
@@ -54,7 +54,7 @@ namespace RTC
...
@@ -54,7 +54,7 @@ namespace RTC
public
:
public
:
void
Update
(
RTC
::
RtpPacket
*
packet
);
void
Update
(
RTC
::
RtpPacket
*
packet
);
uint32_t
Get
R
ate
(
uint64_t
now
);
uint32_t
Get
Bitr
ate
(
uint64_t
now
);
size_t
GetPacketCount
()
const
;
size_t
GetPacketCount
()
const
;
size_t
GetBytes
()
const
;
size_t
GetBytes
()
const
;
...
@@ -87,7 +87,7 @@ namespace RTC
...
@@ -87,7 +87,7 @@ namespace RTC
this
->
oldestTime
=
now
-
this
->
windowSize
;
this
->
oldestTime
=
now
-
this
->
windowSize
;
}
}
inline
uint32_t
RtpDataCounter
::
Get
R
ate
(
uint64_t
now
)
inline
uint32_t
RtpDataCounter
::
Get
Bitr
ate
(
uint64_t
now
)
{
{
return
this
->
rate
.
GetRate
(
now
);
return
this
->
rate
.
GetRate
(
now
);
}
}
...
...
worker/include/RTC/RtpStreamRecv.hpp
浏览文件 @
735bab66
...
@@ -29,9 +29,9 @@ namespace RTC
...
@@ -29,9 +29,9 @@ namespace RTC
public
:
public
:
TransmissionCounter
(
uint8_t
spatialLayers
,
uint8_t
temporalLayers
);
TransmissionCounter
(
uint8_t
spatialLayers
,
uint8_t
temporalLayers
);
void
Update
(
RTC
::
RtpPacket
*
packet
);
void
Update
(
RTC
::
RtpPacket
*
packet
);
uint32_t
Get
R
ate
(
uint64_t
now
);
uint32_t
Get
Bitr
ate
(
uint64_t
now
);
uint32_t
Get
R
ate
(
uint64_t
now
,
uint8_t
spatialLayer
,
uint8_t
temporalLayer
);
uint32_t
Get
Bitr
ate
(
uint64_t
now
,
uint8_t
spatialLayer
,
uint8_t
temporalLayer
);
uint32_t
GetLayer
R
ate
(
uint64_t
now
,
uint8_t
spatialLayer
,
uint8_t
temporalLayer
);
uint32_t
GetLayer
Bitr
ate
(
uint64_t
now
,
uint8_t
spatialLayer
,
uint8_t
temporalLayer
);
size_t
GetPacketCount
()
const
;
size_t
GetPacketCount
()
const
;
size_t
GetBytes
()
const
;
size_t
GetBytes
()
const
;
...
@@ -46,7 +46,6 @@ namespace RTC
...
@@ -46,7 +46,6 @@ namespace RTC
void
FillJsonStats
(
json
&
jsonObject
)
override
;
void
FillJsonStats
(
json
&
jsonObject
)
override
;
bool
ReceivePacket
(
RTC
::
RtpPacket
*
packet
)
override
;
bool
ReceivePacket
(
RTC
::
RtpPacket
*
packet
)
override
;
bool
ReceiveRtxPacket
(
RTC
::
RtpPacket
*
packet
);
bool
ReceiveRtxPacket
(
RTC
::
RtpPacket
*
packet
);
uint32_t
GetRate
(
uint64_t
now
);
RTC
::
RTCP
::
ReceiverReport
*
GetRtcpReceiverReport
();
RTC
::
RTCP
::
ReceiverReport
*
GetRtcpReceiverReport
();
void
ReceiveRtcpSenderReport
(
RTC
::
RTCP
::
SenderReport
*
report
);
void
ReceiveRtcpSenderReport
(
RTC
::
RTCP
::
SenderReport
*
report
);
void
RequestKeyFrame
();
void
RequestKeyFrame
();
...
@@ -90,17 +89,17 @@ namespace RTC
...
@@ -90,17 +89,17 @@ namespace RTC
inline
uint32_t
RtpStreamRecv
::
GetBitrate
(
uint64_t
now
)
inline
uint32_t
RtpStreamRecv
::
GetBitrate
(
uint64_t
now
)
{
{
return
this
->
transmissionCounter
.
Get
R
ate
(
now
);
return
this
->
transmissionCounter
.
Get
Bitr
ate
(
now
);
}
}
inline
uint32_t
RtpStreamRecv
::
GetBitrate
(
uint64_t
now
,
uint8_t
spatialLayer
,
uint8_t
temporalLayer
)
inline
uint32_t
RtpStreamRecv
::
GetBitrate
(
uint64_t
now
,
uint8_t
spatialLayer
,
uint8_t
temporalLayer
)
{
{
return
this
->
transmissionCounter
.
Get
R
ate
(
now
,
spatialLayer
,
temporalLayer
);
return
this
->
transmissionCounter
.
Get
Bitr
ate
(
now
,
spatialLayer
,
temporalLayer
);
}
}
inline
uint32_t
RtpStreamRecv
::
GetLayerBitrate
(
uint64_t
now
,
uint8_t
spatialLayer
,
uint8_t
temporalLayer
)
inline
uint32_t
RtpStreamRecv
::
GetLayerBitrate
(
uint64_t
now
,
uint8_t
spatialLayer
,
uint8_t
temporalLayer
)
{
{
return
this
->
transmissionCounter
.
Get
R
ate
(
now
,
spatialLayer
,
temporalLayer
);
return
this
->
transmissionCounter
.
Get
LayerBitr
ate
(
now
,
spatialLayer
,
temporalLayer
);
}
}
}
// namespace RTC
}
// namespace RTC
...
...
worker/include/RTC/RtpStreamSend.hpp
浏览文件 @
735bab66
...
@@ -82,7 +82,7 @@ namespace RTC
...
@@ -82,7 +82,7 @@ namespace RTC
inline
uint32_t
RtpStreamSend
::
GetBitrate
(
uint64_t
now
)
inline
uint32_t
RtpStreamSend
::
GetBitrate
(
uint64_t
now
)
{
{
return
this
->
transmissionCounter
.
Get
R
ate
(
now
);
return
this
->
transmissionCounter
.
Get
Bitr
ate
(
now
);
}
}
}
// namespace RTC
}
// namespace RTC
...
...
worker/src/RTC/RembClient.cpp
浏览文件 @
735bab66
...
@@ -63,7 +63,7 @@ namespace RTC
...
@@ -63,7 +63,7 @@ namespace RTC
int64_t
trend
=
int64_t
trend
=
static_cast
<
int64_t
>
(
this
->
availableBitrate
)
-
static_cast
<
int64_t
>
(
previousAvailableBitrate
);
static_cast
<
int64_t
>
(
this
->
availableBitrate
)
-
static_cast
<
int64_t
>
(
previousAvailableBitrate
);
uint32_t
usedBitrate
=
this
->
transmissionCounter
.
Get
R
ate
(
now
);
uint32_t
usedBitrate
=
this
->
transmissionCounter
.
Get
Bitr
ate
(
now
);
if
(
this
->
availableBitrate
>=
usedBitrate
)
if
(
this
->
availableBitrate
>=
usedBitrate
)
{
{
...
...
worker/src/RTC/RtpStreamRecv.cpp
浏览文件 @
735bab66
...
@@ -44,7 +44,7 @@ namespace RTC
...
@@ -44,7 +44,7 @@ namespace RTC
counter
.
Update
(
packet
);
counter
.
Update
(
packet
);
}
}
uint32_t
RtpStreamRecv
::
TransmissionCounter
::
Get
R
ate
(
uint64_t
now
)
uint32_t
RtpStreamRecv
::
TransmissionCounter
::
Get
Bitr
ate
(
uint64_t
now
)
{
{
uint32_t
rate
{
0u
};
uint32_t
rate
{
0u
};
...
@@ -52,14 +52,14 @@ namespace RTC
...
@@ -52,14 +52,14 @@ namespace RTC
{
{
for
(
auto
&
temporalLayerCounter
:
spatialLayerCounter
)
for
(
auto
&
temporalLayerCounter
:
spatialLayerCounter
)
{
{
rate
+=
temporalLayerCounter
.
Get
R
ate
(
now
);
rate
+=
temporalLayerCounter
.
Get
Bitr
ate
(
now
);
}
}
}
}
return
rate
;
return
rate
;
}
}
uint32_t
RtpStreamRecv
::
TransmissionCounter
::
Get
R
ate
(
uint32_t
RtpStreamRecv
::
TransmissionCounter
::
Get
Bitr
ate
(
uint64_t
now
,
uint8_t
spatialLayer
,
uint8_t
temporalLayer
)
uint64_t
now
,
uint8_t
spatialLayer
,
uint8_t
temporalLayer
)
{
{
uint32_t
rate
{
0u
};
uint32_t
rate
{
0u
};
...
@@ -70,7 +70,7 @@ namespace RTC
...
@@ -70,7 +70,7 @@ namespace RTC
{
{
for
(
auto
&
temporalLayerCounter
:
spatialLayerCounter
)
for
(
auto
&
temporalLayerCounter
:
spatialLayerCounter
)
{
{
rate
+=
temporalLayerCounter
.
Get
R
ate
(
now
);
rate
+=
temporalLayerCounter
.
Get
Bitr
ate
(
now
);
if
(
++
temporalLayerIdx
>
temporalLayer
)
if
(
++
temporalLayerIdx
>
temporalLayer
)
break
;
break
;
...
@@ -113,7 +113,7 @@ namespace RTC
...
@@ -113,7 +113,7 @@ namespace RTC
return
bytes
;
return
bytes
;
}
}
uint32_t
RtpStreamRecv
::
TransmissionCounter
::
GetLayer
R
ate
(
uint32_t
RtpStreamRecv
::
TransmissionCounter
::
GetLayer
Bitr
ate
(
uint64_t
now
,
uint8_t
spatialLayer
,
uint8_t
temporalLayer
)
uint64_t
now
,
uint8_t
spatialLayer
,
uint8_t
temporalLayer
)
{
{
// Sanity check. Do not allow spatial layers higher than defined.
// Sanity check. Do not allow spatial layers higher than defined.
...
@@ -126,7 +126,7 @@ namespace RTC
...
@@ -126,7 +126,7 @@ namespace RTC
auto
&
counter
=
this
->
spatialLayerCounters
.
at
(
spatialLayer
).
at
(
temporalLayer
);
auto
&
counter
=
this
->
spatialLayerCounters
.
at
(
spatialLayer
).
at
(
temporalLayer
);
return
counter
.
Get
R
ate
(
now
);
return
counter
.
Get
Bitr
ate
(
now
);
}
}
/* Instance methods. */
/* Instance methods. */
...
@@ -173,7 +173,22 @@ namespace RTC
...
@@ -173,7 +173,22 @@ namespace RTC
jsonObject
[
"jitter"
]
=
this
->
jitter
;
jsonObject
[
"jitter"
]
=
this
->
jitter
;
jsonObject
[
"packetCount"
]
=
this
->
transmissionCounter
.
GetPacketCount
();
jsonObject
[
"packetCount"
]
=
this
->
transmissionCounter
.
GetPacketCount
();
jsonObject
[
"byteCount"
]
=
this
->
transmissionCounter
.
GetBytes
();
jsonObject
[
"byteCount"
]
=
this
->
transmissionCounter
.
GetBytes
();
jsonObject
[
"bitrate"
]
=
this
->
transmissionCounter
.
GetRate
(
now
);
jsonObject
[
"bitrate"
]
=
this
->
transmissionCounter
.
GetBitrate
(
now
);
if
(
GetSpatialLayers
()
>
1
||
GetTemporalLayers
()
>
1
)
{
jsonObject
[
"bitrateByLayer"
]
=
json
::
object
();
auto
jsonLayerBitrateIt
=
jsonObject
.
find
(
"bitrateByLayer"
);
for
(
uint8_t
sIdx
=
0
;
sIdx
<
GetSpatialLayers
();
++
sIdx
)
{
for
(
uint8_t
tIdx
=
0
;
tIdx
<
GetTemporalLayers
();
++
tIdx
)
{
(
*
jsonLayerBitrateIt
)[
std
::
to_string
(
sIdx
)
+
"."
+
std
::
to_string
(
tIdx
)]
=
GetLayerBitrate
(
now
,
sIdx
,
tIdx
);
}
}
}
}
}
bool
RtpStreamRecv
::
ReceivePacket
(
RTC
::
RtpPacket
*
packet
)
bool
RtpStreamRecv
::
ReceivePacket
(
RTC
::
RtpPacket
*
packet
)
...
@@ -612,7 +627,7 @@ namespace RTC
...
@@ -612,7 +627,7 @@ namespace RTC
auto
now
=
DepLibUV
::
GetTime
();
auto
now
=
DepLibUV
::
GetTime
();
// If no RTP is being received reset the score.
// If no RTP is being received reset the score.
if
(
this
->
transmissionCounter
.
Get
R
ate
(
now
)
==
0
)
if
(
this
->
transmissionCounter
.
Get
Bitr
ate
(
now
)
==
0
)
{
{
this
->
inactive
=
true
;
this
->
inactive
=
true
;
this
->
inactivityCheckPeriodicTimer
->
Stop
();
this
->
inactivityCheckPeriodicTimer
->
Stop
();
...
...
worker/src/RTC/RtpStreamSend.cpp
浏览文件 @
735bab66
...
@@ -48,7 +48,7 @@ namespace RTC
...
@@ -48,7 +48,7 @@ namespace RTC
jsonObject
[
"roundTripTime"
]
=
this
->
rtt
;
jsonObject
[
"roundTripTime"
]
=
this
->
rtt
;
jsonObject
[
"packetCount"
]
=
this
->
transmissionCounter
.
GetPacketCount
();
jsonObject
[
"packetCount"
]
=
this
->
transmissionCounter
.
GetPacketCount
();
jsonObject
[
"byteCount"
]
=
this
->
transmissionCounter
.
GetBytes
();
jsonObject
[
"byteCount"
]
=
this
->
transmissionCounter
.
GetBytes
();
jsonObject
[
"bitrate"
]
=
this
->
transmissionCounter
.
Get
R
ate
(
now
);
jsonObject
[
"bitrate"
]
=
this
->
transmissionCounter
.
Get
Bitr
ate
(
now
);
}
}
bool
RtpStreamSend
::
ReceivePacket
(
RTC
::
RtpPacket
*
packet
)
bool
RtpStreamSend
::
ReceivePacket
(
RTC
::
RtpPacket
*
packet
)
...
...
worker/src/RTC/SimulcastConsumer.cpp
浏览文件 @
735bab66
...
@@ -101,6 +101,33 @@ namespace RTC
...
@@ -101,6 +101,33 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
auto
now
=
DepLibUV
::
GetTime
();
// TODO
for
(
auto
*
rtpStream
:
this
->
producerRtpStreams
)
{
if
(
!
rtpStream
)
continue
;
MS_ERROR
(
"Producer RtpStream [total bitrate:%"
PRIu32
"]"
,
rtpStream
->
GetBitrate
(
now
));
for
(
uint8_t
sIdx
=
0
;
sIdx
<
rtpStream
->
GetSpatialLayers
();
++
sIdx
)
{
for
(
uint8_t
tIdx
=
0
;
tIdx
<
rtpStream
->
GetTemporalLayers
();
++
tIdx
)
{
MS_ERROR
(
"- [spatial:%"
PRIu8
", temporal:%"
PRIu8
", layer bitrate:%"
PRIu32
", total bitrate:%"
PRIu32
"]"
,
sIdx
,
tIdx
,
rtpStream
->
GetLayerBitrate
(
now
,
sIdx
,
tIdx
),
rtpStream
->
GetBitrate
(
now
,
sIdx
,
tIdx
));
}
}
return
;
}
// Call the parent method.
// Call the parent method.
RTC
::
Consumer
::
FillJson
(
jsonObject
);
RTC
::
Consumer
::
FillJson
(
jsonObject
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论