Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
5bb556b2
提交
5bb556b2
authored
4月 05, 2019
作者:
José Luis Millán
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
RtpStream: more work on score calculation
上级
ef7b672d
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
58 行增加
和
17 行删除
+58
-17
RtpStreamRecv.cpp
worker/src/RTC/RtpStreamRecv.cpp
+12
-2
RtpStreamSend.cpp
worker/src/RTC/RtpStreamSend.cpp
+46
-15
没有找到文件。
worker/src/RTC/RtpStreamRecv.cpp
浏览文件 @
5bb556b2
...
@@ -408,7 +408,17 @@ namespace RTC
...
@@ -408,7 +408,17 @@ namespace RTC
}
}
if
(
repaired
>
lost
)
if
(
repaired
>
lost
)
repaired
=
lost
;
{
if
(
this
->
HasRtx
())
{
repaired
=
lost
;
retransmitted
-=
repaired
-
lost
;
}
else
{
lost
=
repaired
;
}
}
MS_ERROR
(
MS_ERROR
(
"fixed values [expected:%"
PRIu32
",received:%"
PRIu32
", lost:%"
PRIu32
", repaired:%"
PRIu32
"fixed values [expected:%"
PRIu32
",received:%"
PRIu32
", lost:%"
PRIu32
", repaired:%"
PRIu32
...
@@ -419,7 +429,7 @@ namespace RTC
...
@@ -419,7 +429,7 @@ namespace RTC
repaired
,
repaired
,
retransmitted
);
retransmitted
);
float
repairedRatio
=
repaired
/
received
;
float
repairedRatio
=
static_cast
<
float
>
(
repaired
)
/
static_cast
<
float
>
(
received
)
;
auto
repairedWeight
=
std
::
pow
(
1
/
(
repairedRatio
+
1
),
4
);
auto
repairedWeight
=
std
::
pow
(
1
/
(
repairedRatio
+
1
),
4
);
MS_ASSERT
(
retransmitted
>=
repaired
,
"repaired packets cannot be more than retransmitted ones"
);
MS_ASSERT
(
retransmitted
>=
repaired
,
"repaired packets cannot be more than retransmitted ones"
);
...
...
worker/src/RTC/RtpStreamSend.cpp
浏览文件 @
5bb556b2
...
@@ -525,6 +525,12 @@ namespace RTC
...
@@ -525,6 +525,12 @@ namespace RTC
this
->
repairedPrior
=
totalRepaired
;
this
->
repairedPrior
=
totalRepaired
;
// Calculate number of packets retransmitted in this interval.
auto
totatRetransmitted
=
this
->
packetsRetransmitted
;
uint32_t
retransmitted
=
totatRetransmitted
-
this
->
retransmittedPrior
;
this
->
retransmittedPrior
=
totatRetransmitted
;
// We didn't send any packet.
// We didn't send any packet.
if
(
sent
==
0
)
if
(
sent
==
0
)
{
{
...
@@ -533,25 +539,50 @@ namespace RTC
...
@@ -533,25 +539,50 @@ namespace RTC
return
;
return
;
}
}
if
(
repaired
>=
lost
)
if
(
repaired
>
lost
)
lost
=
0
;
{
else
if
(
this
->
HasRtx
())
lost
-=
repaired
;
{
repaired
=
lost
;
retransmitted
-=
repaired
-
lost
;
}
else
{
lost
=
repaired
;
}
}
MS_ERROR
(
"fixed values [sent:%zu, lost:%"
PRIu32
", repaired:%"
PRIu32
", retransmitted:%"
PRIu32
,
sent
,
lost
,
repaired
,
retransmitted
);
float
repairedRatio
=
static_cast
<
float
>
(
repaired
)
/
static_cast
<
float
>
(
sent
);
auto
repairedWeight
=
std
::
pow
(
1
/
(
repairedRatio
+
1
),
4
);
MS_ASSERT
(
retransmitted
>=
repaired
,
"repaired packets cannot be more than retransmitted ones"
);
if
(
retransmitted
>
0
)
repairedWeight
*=
repaired
/
retransmitted
;
lost
-=
repaired
*
repairedWeight
;
MS_ERROR
(
"[repairedRatio:%f, repairedWeight:%f, new lost:%"
PRIu32
"]"
,
repairedRatio
,
repairedWeight
,
lost
);
// Calculate packet loss percentage in this interval.
float
deliveredRatio
=
static_cast
<
float
>
(
sent
-
lost
)
/
static_cast
<
float
>
(
sent
);
float
lossPercentage
=
lost
*
100
/
(
sent
>
lost
?
sent
:
lost
);
/*
auto
score
=
std
::
round
(
std
::
pow
(
deliveredRatio
,
4
)
*
10
);
* Calculate score. Starting from a score of 100:
*
* - Each loss porcentual point has a weight of 1.0f.
*/
float
base100Score
{
100
};
base100Score
-=
(
lossPercentage
*
1.0
f
);
MS_ERROR
(
"RESULT [deliveredRatio:%f, score:%f]"
,
deliveredRatio
,
score
);
// Get base 10 score.
MS_ERROR
(
"++++++++++
\n
"
);
auto
score
=
static_cast
<
uint8_t
>
(
std
::
lround
(
base100Score
/
10
));
#ifdef MS_LOG_DEV
#ifdef MS_LOG_DEV
MS_DEBUG_TAG
(
MS_DEBUG_TAG
(
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论