Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
8e5d79ea
提交
8e5d79ea
authored
3月 20, 2019
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
RtpStream::ResetScore(uint8_t score, bool notify)
上级
78851605
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
35 行增加
和
62 行删除
+35
-62
RtpStream.hpp
worker/include/RTC/RtpStream.hpp
+1
-2
RtpStream.cpp
worker/src/RTC/RtpStream.cpp
+20
-19
RtpStreamRecv.cpp
worker/src/RTC/RtpStreamRecv.cpp
+1
-1
SimulcastConsumer.cpp
worker/src/RTC/SimulcastConsumer.cpp
+13
-40
没有找到文件。
worker/include/RTC/RtpStream.hpp
浏览文件 @
8e5d79ea
...
...
@@ -67,9 +67,9 @@ namespace RTC
uint32_t
GetRtxSsrc
()
const
;
uint8_t
GetRtxPayloadType
()
const
;
virtual
bool
ReceivePacket
(
RTC
::
RtpPacket
*
packet
);
void
PostProcessPacket
(
RTC
::
RtpPacket
*
packet
);
virtual
void
Pause
()
=
0
;
virtual
void
Resume
()
=
0
;
void
ResetScore
(
uint8_t
score
,
bool
notify
);
uint32_t
GetRate
(
uint64_t
now
);
uint8_t
GetFractionLost
()
const
;
float
GetLossPercentage
()
const
;
...
...
@@ -79,7 +79,6 @@ namespace RTC
protected
:
bool
UpdateSeq
(
RTC
::
RtpPacket
*
packet
);
void
UpdateScore
(
uint8_t
score
);
void
ResetScore
();
void
PacketRetransmitted
(
RTC
::
RtpPacket
*
packet
);
void
PacketRepaired
(
RTC
::
RtpPacket
*
packet
);
uint32_t
GetExpectedPackets
();
...
...
worker/src/RTC/RtpStream.cpp
浏览文件 @
8e5d79ea
...
...
@@ -118,6 +118,26 @@ namespace RTC
return
true
;
}
void
RtpStream
::
ResetScore
(
uint8_t
score
,
bool
notify
)
{
MS_TRACE
();
this
->
totalSourceLoss
=
0
;
this
->
totalReportedLoss
=
0
;
this
->
totalSentPackets
=
0
;
this
->
scores
.
clear
();
if
(
this
->
score
!=
score
)
{
this
->
score
=
score
;
// Notify the listener.
if
(
notify
)
this
->
listener
->
OnRtpStreamScore
(
this
,
score
);
}
}
bool
RtpStream
::
UpdateSeq
(
RTC
::
RtpPacket
*
packet
)
{
MS_TRACE
();
...
...
@@ -254,25 +274,6 @@ namespace RTC
}
}
void
RtpStream
::
ResetScore
()
{
MS_TRACE
();
this
->
totalSourceLoss
=
0
;
this
->
totalReportedLoss
=
0
;
this
->
totalSentPackets
=
0
;
this
->
scores
.
clear
();
if
(
this
->
score
!=
0
)
{
this
->
score
=
0
;
// Notify the listener.
this
->
listener
->
OnRtpStreamScore
(
this
,
0
);
}
}
void
RtpStream
::
PacketRetransmitted
(
RTC
::
RtpPacket
*
packet
)
{
MS_TRACE
();
...
...
worker/src/RTC/RtpStreamRecv.cpp
浏览文件 @
8e5d79ea
...
...
@@ -443,7 +443,7 @@ namespace RTC
if
(
GetScore
()
!=
0
)
MS_WARN_2TAGS
(
rtp
,
score
,
"RTP inactivity detected, resetting score to 0"
);
ResetScore
();
ResetScore
(
0
,
true
);
}
}
}
...
...
worker/src/RTC/SimulcastConsumer.cpp
浏览文件 @
8e5d79ea
...
...
@@ -6,7 +6,6 @@
#include "MediaSoupErrors.hpp"
#include "Channel/Notifier.hpp"
#include "RTC/Codecs/Codecs.hpp"
#include <iostream>
namespace
RTC
{
...
...
@@ -587,6 +586,9 @@ namespace RTC
this
->
currentSpatialLayer
=
spatialLayer
;
// Reset the score of our RtpStream to 10.
this
->
rtpStream
->
ResetScore
(
10
,
false
);
MS_DEBUG_DEV
(
"current spatial layer changed to %"
PRIi16
" [consumerId:%s]"
,
this
->
currentSpatialLayer
,
...
...
@@ -608,34 +610,10 @@ namespace RTC
int16_t
newTargetSpatialLayer
{
-
1
};
if
(
this
->
GetProducerCurrentRtpStream
())
{
std
::
cout
<<
"RecalculateTargetSpatialLayer."
<<
", consumer score: "
<<
static_cast
<
unsigned
int
>
(
this
->
rtpStream
->
GetScore
())
<<
", producer score: "
<<
static_cast
<
unsigned
int
>
(
this
->
GetProducerCurrentRtpStream
()
->
GetScore
())
<<
", currentSpatialLayer: "
<<
static_cast
<
int
>
(
this
->
currentSpatialLayer
)
<<
", targetSpatialLayer: "
<<
static_cast
<
int
>
(
this
->
targetSpatialLayer
)
<<
", preferredSpatialLayer: "
<<
static_cast
<
int
>
(
this
->
preferredSpatialLayer
)
<<
std
::
endl
;
}
else
{
std
::
cout
<<
"RecalculateTargetSpatialLayer."
<<
", consumer score: "
<<
static_cast
<
unsigned
int
>
(
this
->
rtpStream
->
GetScore
())
<<
", producer score: "
<<
"nullptr"
<<
", currentSpatialLayer: "
<<
static_cast
<
int
>
(
this
->
currentSpatialLayer
)
<<
", targetSpatialLayer: "
<<
static_cast
<
int
>
(
this
->
targetSpatialLayer
)
<<
", preferredSpatialLayer: "
<<
static_cast
<
int
>
(
this
->
preferredSpatialLayer
)
<<
std
::
endl
;
}
// No current spatial layer, select the highest possible.
if
(
this
->
currentSpatialLayer
==
-
1
)
{
std
::
cout
<<
"RecalculateTargetSpatialLayer. no current spatial layer, selecting the highest possible..."
<<
std
::
endl
;
MS_DEBUG_TAG
(
simulcast
,
"no current spatial layer, selecting the highest possible"
);
uint8_t
maxScore
=
0
;
...
...
@@ -651,15 +629,12 @@ namespace RTC
if
(
producerRtpStream
->
GetScore
()
>=
maxScore
)
{
std
::
cout
<<
"RecalculateTargetSpatialLayer. we have something: "
<<
spatialLayer
<<
std
::
endl
;
maxScore
=
producerRtpStream
->
GetScore
();
newTargetSpatialLayer
=
spatialLayer
;
if
(
maxScore
>
7
)
{
std
::
cout
<<
"RecalculateTargetSpatialLayer. score > 7, keep it : "
<<
spatialLayer
<<
std
::
endl
;
MS_DEBUG_TAG
(
simulcast
,
"found Producer RtpStream with score > 7, keep it"
);
break
;
}
...
...
@@ -671,7 +646,7 @@ namespace RTC
!
this
->
GetProducerCurrentRtpStream
()
||
this
->
GetProducerCurrentRtpStream
()
->
GetScore
()
<
7
||
this
->
rtpStream
->
GetScore
()
<
5
||
this
->
preferredSpatialLayer
<
this
->
currentSpatialLayer
)
{
std
::
cout
<<
"RecalculateTargetSpatialLayer. downgrading..."
<<
std
::
endl
;
MS_DEBUG_TAG
(
simulcast
,
"trying to downgrade current spatial layer"
)
;
uint8_t
maxScore
=
0
;
...
...
@@ -686,15 +661,12 @@ namespace RTC
if
(
producerRtpStream
->
GetScore
()
>=
maxScore
)
{
std
::
cout
<<
"RecalculateTargetSpatialLayer. we have something: "
<<
spatialLayer
<<
std
::
endl
;
maxScore
=
producerRtpStream
->
GetScore
();
newTargetSpatialLayer
=
spatialLayer
;
if
(
maxScore
>
7
)
{
std
::
cout
<<
"RecalculateTargetSpatialLayer. score > 7, keep it : "
<<
spatialLayer
<<
std
::
endl
;
MS_DEBUG_TAG
(
simulcast
,
"found Producer RtpStream with score > 7, keep it"
);
break
;
}
...
...
@@ -704,7 +676,7 @@ namespace RTC
// Update to the highest possible spatial layer.
else
{
std
::
cout
<<
"RecalculateTargetSpatialLayer. trying to upgrade..."
<<
std
::
endl
;
MS_DEBUG_TAG
(
simulcast
,
"trying to upgrade current spatial layer"
)
;
int16_t
idx
=
this
->
currentSpatialLayer
==
-
1
?
0
:
this
->
currentSpatialLayer
+
1
;
...
...
@@ -721,8 +693,8 @@ namespace RTC
// Take this as the new target if it is good enough.
if
(
producerRtpStream
->
GetScore
()
>=
7
)
{
std
::
cout
<<
"RecalculateTargetSpatialLayer. good enough spatial layer found: "
<<
spatialLayer
<<
std
::
endl
;
MS_DEBUG_TAG
(
simulcast
,
"good enough spatial layer found: %"
PRIi16
,
spatialLayer
);
newTargetSpatialLayer
=
spatialLayer
;
break
;
...
...
@@ -732,7 +704,8 @@ namespace RTC
if
(
newTargetSpatialLayer
==
-
1
)
{
std
::
cout
<<
"RecalculateTargetSpatialLayer, target layer not updated"
<<
std
::
endl
;
MS_DEBUG_TAG
(
simulcast
,
"newTargetSpatialLayer remains unset"
);
return
;
}
...
...
@@ -749,7 +722,7 @@ namespace RTC
RequestKeyFrame
();
MS_DEBUG_TAG
(
rtp
,
simulcast
,
"target spatial layer changed to %"
PRIi16
" [consumerId:%s]"
,
this
->
targetSpatialLayer
,
this
->
id
.
c_str
());
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论