Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
5d623558
提交
5d623558
authored
10月 04, 2017
作者:
José Luis Millán
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
RTC: lossPercentage
上级
1eda3c28
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
47 行增加
和
6 行删除
+47
-6
Consumer.hpp
worker/include/RTC/Consumer.hpp
+1
-0
RtpStream.hpp
worker/include/RTC/RtpStream.hpp
+8
-3
Consumer.cpp
worker/src/RTC/Consumer.cpp
+25
-0
Producer.cpp
worker/src/RTC/Producer.cpp
+10
-0
RtpStreamSend.cpp
worker/src/RTC/RtpStreamSend.cpp
+3
-3
没有找到文件。
worker/include/RTC/Consumer.hpp
浏览文件 @
5d623558
...
...
@@ -57,6 +57,7 @@ namespace RTC
void
ReceiveKeyFrameRequest
(
RTCP
::
FeedbackPs
::
MessageType
messageType
);
void
ReceiveRtcpReceiverReport
(
RTC
::
RTCP
::
ReceiverReport
*
report
);
uint32_t
GetTransmissionRate
(
uint64_t
now
);
float
GetLossPercentage
()
const
;
void
RequestKeyFrame
();
private
:
...
...
worker/include/RTC/RtpStream.hpp
浏览文件 @
5d623558
...
...
@@ -48,6 +48,7 @@ namespace RTC
uint32_t
GetSsrc
();
uint8_t
GetPayloadType
();
const
RTC
::
RtpCodecMimeType
&
GetMimeType
()
const
;
float
GetLossPercentage
()
const
;
bool
IsHealthy
();
void
ResetHealthCheckTimer
(
uint16_t
timeout
=
HealthCheckPeriod
);
...
...
@@ -67,6 +68,8 @@ namespace RTC
public
:
// Stats.
uint32_t
packetsLost
{
0
};
uint8_t
fractionLost
{
0
};
size_t
packetsDiscarded
{
0
};
size_t
packetsRepaired
{
0
};
size_t
firCount
{
0
};
...
...
@@ -94,9 +97,6 @@ namespace RTC
Timer
*
healthCheckTimer
{
nullptr
};
bool
healthy
{
true
};
bool
notifyHealth
{
true
};
// Stats.
uint32_t
packetsLost
{
0
};
uint8_t
fractionLost
{
0
};
};
/* Inline instance methods. */
...
...
@@ -116,6 +116,11 @@ namespace RTC
return
this
->
params
.
mimeType
;
}
inline
float
RtpStream
::
GetLossPercentage
()
const
{
return
static_cast
<
float
>
(
this
->
fractionLost
)
*
100
/
256
;
}
inline
bool
RtpStream
::
IsHealthy
()
{
return
this
->
healthy
;
...
...
worker/src/RTC/Consumer.cpp
浏览文件 @
5d623558
...
...
@@ -69,6 +69,7 @@ namespace RTC
static
const
Json
::
StaticString
JsonStringSourcePaused
{
"sourcePaused"
};
static
const
Json
::
StaticString
JsonStringPreferredProfile
{
"preferredProfile"
};
static
const
Json
::
StaticString
JsonStringEffectiveProfile
{
"effectiveProfile"
};
static
const
Json
::
StaticString
JsonStringLossPercentage
{
"lossPercentage"
};
Json
::
Value
json
(
Json
::
objectValue
);
...
...
@@ -94,6 +95,8 @@ namespace RTC
json
[
JsonStringEffectiveProfile
]
=
RTC
::
RtpEncodingParameters
::
profile2String
[
this
->
effectiveProfile
];
json
[
JsonStringLossPercentage
]
=
GetLossPercentage
();
return
json
;
}
...
...
@@ -615,6 +618,28 @@ namespace RTC
this
->
rtpStream
->
ReceiveRtcpReceiverReport
(
report
);
}
float
Consumer
::
GetLossPercentage
()
const
{
float
lossPercentage
=
0
;
if
(
this
->
effectiveProfile
!=
RTC
::
RtpEncodingParameters
::
Profile
::
NONE
)
{
auto
it
=
this
->
mapProfileRtpStream
.
find
(
this
->
effectiveProfile
);
MS_ASSERT
(
it
!=
this
->
mapProfileRtpStream
.
end
(),
"no RtpStream associated with current profile"
);
auto
rtpStream
=
it
->
second
;
if
(
rtpStream
->
GetLossPercentage
()
>=
this
->
rtpStream
->
GetLossPercentage
())
lossPercentage
=
0
;
else
lossPercentage
=
(
this
->
rtpStream
->
GetLossPercentage
()
-
rtpStream
->
GetLossPercentage
());
}
return
lossPercentage
;
}
void
Consumer
::
RequestKeyFrame
()
{
MS_TRACE
();
...
...
worker/src/RTC/Producer.cpp
浏览文件 @
5d623558
...
...
@@ -82,6 +82,7 @@ namespace RTC
static
const
Json
::
StaticString
JsonStringAbsSendTime
{
"absSendTime"
};
static
const
Json
::
StaticString
JsonStringRid
{
"rid"
};
static
const
Json
::
StaticString
JsonStringPaused
{
"paused"
};
static
const
Json
::
StaticString
JsonStringLossPercentage
{
"lossPercentage"
};
Json
::
Value
json
(
Json
::
objectValue
);
Json
::
Value
jsonHeaderExtensionIds
(
Json
::
objectValue
);
...
...
@@ -93,14 +94,23 @@ namespace RTC
json
[
JsonStringRtpParameters
]
=
this
->
rtpParameters
.
ToJson
();
float
lossPercentage
=
0
;
for
(
auto
&
kv
:
this
->
rtpStreams
)
{
auto
rtpStream
=
kv
.
second
;
jsonRtpStreams
.
append
(
rtpStream
->
ToJson
());
lossPercentage
+=
rtpStream
->
GetLossPercentage
();
}
json
[
JsonStringRtpStreams
]
=
jsonRtpStreams
;
if
(
!
this
->
rtpStreams
.
empty
())
lossPercentage
=
lossPercentage
/
this
->
rtpStreams
.
size
();
json
[
JsonStringLossPercentage
]
=
lossPercentage
;
if
(
this
->
headerExtensionIds
.
ssrcAudioLevel
!=
0u
)
jsonHeaderExtensionIds
[
JsonStringSsrcAudioLevel
]
=
this
->
headerExtensionIds
.
ssrcAudioLevel
;
...
...
worker/src/RTC/RtpStreamSend.cpp
浏览文件 @
5d623558
...
...
@@ -402,11 +402,11 @@ namespace RTC
{
MS_TRACE
();
uint16_t
currentLossPercentage
=
this
->
fractionLost
*
100
/
256
;
auto
lossPercentage
=
GetLossPercentage
()
;
if
(
currentL
ossPercentage
>=
MaxHealthLossPercentage
)
if
(
l
ossPercentage
>=
MaxHealthLossPercentage
)
{
MS_DEBUG_TAG
(
rtp
,
"last period loss percentage: %
"
PRIu16
,
currentL
ossPercentage
);
MS_DEBUG_TAG
(
rtp
,
"last period loss percentage: %
.2f"
,
l
ossPercentage
);
if
(
this
->
notifyHealth
||
this
->
healthy
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论