Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
345327ca
提交
345327ca
authored
3月 18, 2019
作者:
José Luis Millán
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#247. Calculate consumer score entirely based on the Receiver Reports
上级
df266f1b
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
15 行增加
和
66 行删除
+15
-66
RtpStreamSend.hpp
worker/include/RTC/RtpStreamSend.hpp
+1
-1
RtpStreamSend.cpp
worker/src/RTC/RtpStreamSend.cpp
+14
-65
没有找到文件。
worker/include/RTC/RtpStreamSend.hpp
浏览文件 @
345327ca
...
@@ -56,8 +56,8 @@ namespace RTC
...
@@ -56,8 +56,8 @@ namespace RTC
void
UpdateScore
(
RTC
::
RTCP
::
ReceiverReport
*
report
);
void
UpdateScore
(
RTC
::
RTCP
::
ReceiverReport
*
report
);
private
:
private
:
uint32_t
sourceLostPrior
{
0
};
// Packets lost in source at last interval.
uint32_t
lostPrior
{
0
};
// Packets lost at last interval.
uint32_t
lostPrior
{
0
};
// Packets lost at last interval.
uint32_t
sentPrior
{
0
};
// Packets sent at last interval.
std
::
vector
<
StorageItem
>
storage
;
std
::
vector
<
StorageItem
>
storage
;
std
::
list
<
BufferItem
>
buffer
;
std
::
list
<
BufferItem
>
buffer
;
float
rtt
{
0
};
float
rtt
{
0
};
...
...
worker/src/RTC/RtpStreamSend.cpp
浏览文件 @
345327ca
...
@@ -529,64 +529,31 @@ namespace RTC
...
@@ -529,64 +529,31 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
// Calculate number of packets lost in the source in this interval.
// Calculate number of packets sent in this interval.
auto
totalExpected
=
GetExpectedPackets
();
auto
expected
=
totalExpected
-
this
->
expectedPrior
;
// We didn't send new packets.
if
(
expected
==
0
)
return
;
this
->
expectedPrior
=
totalExpected
;
// TODO: REMOVE
// std::cout << "RtpStreamSend::UpdateScore() 1: totalExpected:" << totalExpected << ",
// expected:" << expected << "\n";
auto
totalSent
=
this
->
transmissionCounter
.
GetPacketCount
();
auto
totalSent
=
this
->
transmissionCounter
.
GetPacketCount
();
auto
totalSourceLost
=
totalExpected
>
totalSent
?
totalExpected
-
totalSent
:
0
;
auto
sent
=
totalSent
-
this
->
sentPrior
;
// Current lost may be less now than before.
if
(
totalSourceLost
<
this
->
sourceLostPrior
)
totalSourceLost
=
this
->
sourceLostPrior
;
auto
sourceLost
=
totalSourceLost
-
this
->
sourceLostPrior
;
// We didn't send any packet.
if
(
sent
==
0
)
this
->
sourceLostPrior
=
totalSourceLost
;
return
;
// TODO: REMOVE
this
->
sentPrior
=
totalSent
;
// std::cout << "RtpStreamSend::UpdateScore() 2: totalSent:" << totalSent << ",
// totalSourceLost:" << totalSourceLost << ", sourceLost:" << sourceLost << "\n";
// Calculate number of packets lost in the edge in this interval.
// Calculate number of packets lost in this interval.
uint32_t
totalLost
=
report
->
GetTotalLost
();
uint32_t
totalLost
=
report
->
GetTotalLost
()
>
0
?
report
->
GetTotalLost
()
:
0
;
uint32_t
lost
;
// Do not trust whatever the received RR says.
if
(
totalLost
<
this
->
lostPrior
)
if
(
totalLost
<
this
->
lostPrior
)
totalLost
=
this
->
lostPrior
;
lost
=
0
;
else
auto
lost
=
totalLost
-
this
->
lostPrior
;
lost
=
totalLost
-
this
->
lostPrior
;
this
->
lostPrior
=
totalLost
;
this
->
lostPrior
=
totalLost
;
// TODO: REMOVE
// std::cout << "RtpStreamSend::UpdateScore() 3: totalLost:" << totalLost << ", lost:" << lost << "\n";
// Substract number of packets lost at the source.
if
(
lost
>
sourceLost
)
lost
=
sourceLost
;
// TODO: REMOVE
// std::cout << "RtpStreamSend::UpdateScore() 4: lost -= sourceLost:" << lost << "\n";
// Calculate number of packets repaired in this interval.
// Calculate number of packets repaired in this interval.
auto
totalRepaired
=
this
->
packetsRepaired
;
auto
totalRepaired
=
this
->
packetsRepaired
;
uint32_t
repaired
=
totalRepaired
-
this
->
repairedPrior
;
uint32_t
repaired
=
totalRepaired
-
this
->
repairedPrior
;
// TODO: REMOVE
// std::cout << "RtpStreamSend::UpdateScore() 5: totalRepaired:" << totalRepaired << ",
// repaired:" << repaired << "\n";
this
->
repairedPrior
=
totalRepaired
;
this
->
repairedPrior
=
totalRepaired
;
if
(
repaired
>=
lost
)
if
(
repaired
>=
lost
)
...
@@ -594,20 +561,8 @@ namespace RTC
...
@@ -594,20 +561,8 @@ namespace RTC
else
else
lost
-=
repaired
;
lost
-=
repaired
;
// TODO: REMOVE
// Calculate packet loss percentage in this interval.
// std::cout << "RtpStreamSend::UpdateScore() 6: lost:" << lost << "\n";
float
lossPercentage
=
lost
*
100
/
(
sent
>
lost
?
sent
:
lost
);
if
(
repaired
>
lost
)
{
MS_DEBUG_TAG
(
score
,
"repaired greater than lost [repaired:%"
PRIu32
", lost:%"
PRIu32
"]"
,
repaired
,
lost
);
}
// Calculate packet loss percentage in this interva.
float
lossPercentage
=
lost
*
100
/
expected
;
// TODO: REMOVE
// std::cout << "RtpStreamSend::UpdateScore() 7: lossPercentage:" << lossPercentage << "\n";
/*
/*
* Calculate score. Starting from a score of 100:
* Calculate score. Starting from a score of 100:
...
@@ -618,15 +573,9 @@ namespace RTC
...
@@ -618,15 +573,9 @@ namespace RTC
base100Score
-=
(
lossPercentage
*
1.0
f
);
base100Score
-=
(
lossPercentage
*
1.0
f
);
// TODO: REMOVE
// std::cout << "RtpStreamSend::UpdateScore() 8: base100Score:" << base100Score << "\n";
// Get base 10 score.
// Get base 10 score.
auto
score
=
static_cast
<
uint8_t
>
(
std
::
lround
(
base100Score
/
10
));
auto
score
=
static_cast
<
uint8_t
>
(
std
::
lround
(
base100Score
/
10
));
// TODO: REMOVE
// std::cout << "RtpStreamSend::UpdateScore() 9: score:" << int{ score } << "\n";
#ifdef MS_LOG_DEV
#ifdef MS_LOG_DEV
MS_DEBUG_TAG
(
MS_DEBUG_TAG
(
score
,
score
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论