Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
e4a757a1
提交
e4a757a1
authored
9月 11, 2017
作者:
José Luis Millán
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
RtpStream: periodic health checks
上级
500d9987
显示空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
76 行增加
和
3 行删除
+76
-3
Consumer.hpp
worker/include/RTC/Consumer.hpp
+5
-1
Producer.hpp
worker/include/RTC/Producer.hpp
+1
-0
RtpStream.hpp
worker/include/RTC/RtpStream.hpp
+15
-1
RtpStreamRecv.hpp
worker/include/RTC/RtpStreamRecv.hpp
+2
-1
RtpStreamSend.hpp
worker/include/RTC/RtpStreamSend.hpp
+1
-0
Consumer.cpp
worker/src/RTC/Consumer.cpp
+8
-0
Producer.cpp
worker/src/RTC/Producer.cpp
+8
-0
RtpStream.cpp
worker/src/RTC/RtpStream.cpp
+20
-0
RtpStreamRecv.cpp
worker/src/RTC/RtpStreamRecv.cpp
+11
-0
RtpStreamSend.cpp
worker/src/RTC/RtpStreamSend.cpp
+5
-0
没有找到文件。
worker/include/RTC/Consumer.hpp
浏览文件 @
e4a757a1
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
namespace
RTC
namespace
RTC
{
{
class
Consumer
class
Consumer
:
public
RtpStream
::
Listener
{
{
public
:
public
:
Consumer
(
Consumer
(
...
@@ -60,6 +60,10 @@ namespace RTC
...
@@ -60,6 +60,10 @@ namespace RTC
void
CreateRtpStream
(
RTC
::
RtpEncodingParameters
&
encoding
);
void
CreateRtpStream
(
RTC
::
RtpEncodingParameters
&
encoding
);
void
RetransmitRtpPacket
(
RTC
::
RtpPacket
*
packet
);
void
RetransmitRtpPacket
(
RTC
::
RtpPacket
*
packet
);
/* Pure virtual methods inherited from RTC::RtpStream::Listener. */
public
:
void
OnRtpStreamHealthReport
(
RTC
::
RtpStream
*
rtpStream
,
bool
healthy
)
override
;
public
:
public
:
// Passed by argument.
// Passed by argument.
uint32_t
consumerId
{
0
};
uint32_t
consumerId
{
0
};
...
...
worker/include/RTC/Producer.hpp
浏览文件 @
e4a757a1
...
@@ -96,6 +96,7 @@ namespace RTC
...
@@ -96,6 +96,7 @@ namespace RTC
void
OnRtpStreamRecvNackRequired
(
void
OnRtpStreamRecvNackRequired
(
RTC
::
RtpStreamRecv
*
rtpStream
,
const
std
::
vector
<
uint16_t
>&
seqNumbers
)
override
;
RTC
::
RtpStreamRecv
*
rtpStream
,
const
std
::
vector
<
uint16_t
>&
seqNumbers
)
override
;
void
OnRtpStreamRecvPliRequired
(
RTC
::
RtpStreamRecv
*
rtpStream
)
override
;
void
OnRtpStreamRecvPliRequired
(
RTC
::
RtpStreamRecv
*
rtpStream
)
override
;
void
OnRtpStreamHealthReport
(
RTC
::
RtpStream
*
rtpStream
,
bool
healthy
)
override
;
/* Pure virtual methods inherited from Timer::Listener. */
/* Pure virtual methods inherited from Timer::Listener. */
public
:
public
:
...
...
worker/include/RTC/RtpStream.hpp
浏览文件 @
e4a757a1
...
@@ -4,12 +4,20 @@
...
@@ -4,12 +4,20 @@
#include "common.hpp"
#include "common.hpp"
#include "RTC/RtpDictionaries.hpp"
#include "RTC/RtpDictionaries.hpp"
#include "RTC/RtpPacket.hpp"
#include "RTC/RtpPacket.hpp"
#include "handles/Timer.hpp"
#include <json/json.h>
#include <json/json.h>
namespace
RTC
namespace
RTC
{
{
class
RtpStream
class
RtpStream
:
public
Timer
::
Listener
{
{
public
:
class
Listener
{
public
:
virtual
void
OnRtpStreamHealthReport
(
RTC
::
RtpStream
*
rtpStream
,
bool
healthy
)
=
0
;
};
public
:
public
:
struct
Params
struct
Params
{
{
...
@@ -40,6 +48,11 @@ namespace RTC
...
@@ -40,6 +48,11 @@ namespace RTC
/* Pure virtual methods that must be implemented by the subclass. */
/* Pure virtual methods that must be implemented by the subclass. */
protected
:
protected
:
virtual
void
OnInitSeq
()
=
0
;
virtual
void
OnInitSeq
()
=
0
;
virtual
void
CheckHealth
()
=
0
;
/* Pure virtual methods inherited from Timer::Listener. */
public
:
void
OnTimer
(
Timer
*
timer
)
override
;
protected
:
protected
:
// Given as argument.
// Given as argument.
...
@@ -58,6 +71,7 @@ namespace RTC
...
@@ -58,6 +71,7 @@ namespace RTC
uint32_t
receivedPrior
{
0
};
// Packet received at last interval.
uint32_t
receivedPrior
{
0
};
// Packet received at last interval.
// Others.
// Others.
uint32_t
maxTimestamp
{
0
};
// Highest timestamp seen.
uint32_t
maxTimestamp
{
0
};
// Highest timestamp seen.
Timer
*
healthCheckTimer
{
nullptr
};
};
};
/* Inline instance methods. */
/* Inline instance methods. */
...
...
worker/include/RTC/RtpStreamRecv.hpp
浏览文件 @
e4a757a1
...
@@ -12,7 +12,7 @@ namespace RTC
...
@@ -12,7 +12,7 @@ namespace RTC
class
RtpStreamRecv
:
public
RtpStream
,
public
RTC
::
NackGenerator
::
Listener
class
RtpStreamRecv
:
public
RtpStream
,
public
RTC
::
NackGenerator
::
Listener
{
{
public
:
public
:
class
Listener
class
Listener
:
public
RtpStream
::
Listener
{
{
public
:
public
:
virtual
void
OnRtpStreamRecvNackRequired
(
virtual
void
OnRtpStreamRecvNackRequired
(
...
@@ -39,6 +39,7 @@ namespace RTC
...
@@ -39,6 +39,7 @@ namespace RTC
/* Pure virtual methods inherited from RtpStream. */
/* Pure virtual methods inherited from RtpStream. */
protected
:
protected
:
void
OnInitSeq
()
override
;
void
OnInitSeq
()
override
;
virtual
void
CheckHealth
()
override
;
/* Pure virtual methods inherited from RTC::NackGenerator. */
/* Pure virtual methods inherited from RTC::NackGenerator. */
protected
:
protected
:
...
...
worker/include/RTC/RtpStreamSend.hpp
浏览文件 @
e4a757a1
...
@@ -47,6 +47,7 @@ namespace RTC
...
@@ -47,6 +47,7 @@ namespace RTC
/* Pure virtual methods inherited from RtpStream. */
/* Pure virtual methods inherited from RtpStream. */
protected
:
protected
:
void
OnInitSeq
()
override
;
void
OnInitSeq
()
override
;
void
CheckHealth
()
override
;
private
:
private
:
std
::
vector
<
StorageItem
>
storage
;
std
::
vector
<
StorageItem
>
storage
;
...
...
worker/src/RTC/Consumer.cpp
浏览文件 @
e4a757a1
...
@@ -457,6 +457,14 @@ namespace RTC
...
@@ -457,6 +457,14 @@ namespace RTC
}
}
}
}
void
Consumer
::
OnRtpStreamHealthReport
(
RtpStream
*
stream
,
bool
healthy
)
{
MS_TRACE
();
if
(
!
IsEnabled
())
return
;
}
void
Consumer
::
FillSupportedCodecPayloadTypes
()
void
Consumer
::
FillSupportedCodecPayloadTypes
()
{
{
MS_TRACE
();
MS_TRACE
();
...
...
worker/src/RTC/Producer.cpp
浏览文件 @
e4a757a1
...
@@ -700,6 +700,14 @@ namespace RTC
...
@@ -700,6 +700,14 @@ namespace RTC
this
->
transport
->
SendRtcpPacket
(
&
packet
);
this
->
transport
->
SendRtcpPacket
(
&
packet
);
}
}
void
Producer
::
OnRtpStreamHealthReport
(
RTC
::
RtpStream
*
rtpStream
,
bool
healthy
)
{
MS_TRACE
();
if
(
!
healthy
)
MS_DEBUG_TAG
(
rtp
,
"stream is not healthy [ssrc:%"
PRIu32
"]"
,
rtpStream
->
GetSsrc
());
}
inline
void
Producer
::
OnTimer
(
Timer
*
timer
)
inline
void
Producer
::
OnTimer
(
Timer
*
timer
)
{
{
MS_TRACE
();
MS_TRACE
();
...
...
worker/src/RTC/RtpStream.cpp
浏览文件 @
e4a757a1
...
@@ -14,17 +14,27 @@ namespace RTC
...
@@ -14,17 +14,27 @@ namespace RTC
static
constexpr
uint16_t
MaxDropout
{
3000
};
static
constexpr
uint16_t
MaxDropout
{
3000
};
static
constexpr
uint16_t
MaxMisorder
{
100
};
static
constexpr
uint16_t
MaxMisorder
{
100
};
static
constexpr
uint32_t
RtpSeqMod
{
1
<<
16
};
static
constexpr
uint32_t
RtpSeqMod
{
1
<<
16
};
static
constexpr
uint16_t
HealthCheckPeriod
{
1000
};
/* Instance methods. */
/* Instance methods. */
RtpStream
::
RtpStream
(
RTC
::
RtpStream
::
Params
&
params
)
:
params
(
params
)
RtpStream
::
RtpStream
(
RTC
::
RtpStream
::
Params
&
params
)
:
params
(
params
)
{
{
MS_TRACE
();
MS_TRACE
();
// Set the health check timer.
this
->
healthCheckTimer
=
new
Timer
(
this
);
// Run the timer.
this
->
healthCheckTimer
->
Start
(
HealthCheckPeriod
,
HealthCheckPeriod
);
}
}
RtpStream
::~
RtpStream
()
RtpStream
::~
RtpStream
()
{
{
MS_TRACE
();
MS_TRACE
();
// Close the health check timer.
this
->
healthCheckTimer
->
Destroy
();
}
}
bool
RtpStream
::
ReceivePacket
(
RTC
::
RtpPacket
*
packet
)
bool
RtpStream
::
ReceivePacket
(
RTC
::
RtpPacket
*
packet
)
...
@@ -192,4 +202,14 @@ namespace RTC
...
@@ -192,4 +202,14 @@ namespace RTC
return
json
;
return
json
;
}
}
void
RtpStream
::
OnTimer
(
Timer
*
timer
)
{
MS_TRACE
();
if
(
timer
==
this
->
healthCheckTimer
)
{
this
->
CheckHealth
();
}
}
}
// namespace RTC
}
// namespace RTC
worker/src/RTC/RtpStreamRecv.cpp
浏览文件 @
e4a757a1
...
@@ -247,6 +247,17 @@ namespace RTC
...
@@ -247,6 +247,17 @@ namespace RTC
// Do nothing.
// Do nothing.
}
}
void
RtpStreamRecv
::
CheckHealth
()
{
auto
now
=
DepLibUV
::
GetTime
();
bool
healthy
=
true
;
if
(
this
->
receivedCounter
.
GetRate
(
now
)
==
0
)
healthy
=
false
;
this
->
listener
->
OnRtpStreamHealthReport
(
this
,
healthy
);
}
void
RtpStreamRecv
::
OnNackGeneratorNackRequired
(
const
std
::
vector
<
uint16_t
>&
seqNumbers
)
void
RtpStreamRecv
::
OnNackGeneratorNackRequired
(
const
std
::
vector
<
uint16_t
>&
seqNumbers
)
{
{
MS_TRACE
();
MS_TRACE
();
...
...
worker/src/RTC/RtpStreamSend.cpp
浏览文件 @
e4a757a1
...
@@ -443,6 +443,11 @@ namespace RTC
...
@@ -443,6 +443,11 @@ namespace RTC
ClearRetransmissionBuffer
();
ClearRetransmissionBuffer
();
}
}
void
RtpStreamSend
::
CheckHealth
()
{
MS_TRACE
();
}
void
RtpStreamSend
::
SetRtx
(
uint8_t
payloadType
,
uint32_t
ssrc
)
void
RtpStreamSend
::
SetRtx
(
uint8_t
payloadType
,
uint32_t
ssrc
)
{
{
MS_TRACE
();
MS_TRACE
();
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论