提交 3ff70302 authored 作者: José Luis Millán's avatar José Luis Millán

RtpStream: add method IsHealthy

上级 a1360000
...@@ -36,8 +36,9 @@ namespace RTC ...@@ -36,8 +36,9 @@ namespace RTC
virtual ~RtpStream(); virtual ~RtpStream();
virtual Json::Value ToJson() = 0; virtual Json::Value ToJson() = 0;
uint32_t GetSsrc();
virtual bool ReceivePacket(RTC::RtpPacket* packet); virtual bool ReceivePacket(RTC::RtpPacket* packet);
uint32_t GetSsrc();
bool IsHealthy();
protected: protected:
void InitSeq(uint16_t seq); void InitSeq(uint16_t seq);
...@@ -72,6 +73,7 @@ namespace RTC ...@@ -72,6 +73,7 @@ namespace RTC
// Others. // Others.
uint32_t maxTimestamp{ 0 }; // Highest timestamp seen. uint32_t maxTimestamp{ 0 }; // Highest timestamp seen.
Timer* healthCheckTimer{ nullptr }; Timer* healthCheckTimer{ nullptr };
bool healthy{ true };
}; };
/* Inline instance methods. */ /* Inline instance methods. */
...@@ -80,6 +82,11 @@ namespace RTC ...@@ -80,6 +82,11 @@ namespace RTC
{ {
return this->params.ssrc; return this->params.ssrc;
} }
inline bool RtpStream::IsHealthy()
{
return this->healthy;
}
} // namespace RTC } // namespace RTC
#endif #endif
...@@ -250,12 +250,13 @@ namespace RTC ...@@ -250,12 +250,13 @@ namespace RTC
void RtpStreamRecv::CheckHealth() void RtpStreamRecv::CheckHealth()
{ {
auto now = DepLibUV::GetTime(); auto now = DepLibUV::GetTime();
bool healthy = true;
if (this->receivedCounter.GetRate(now) == 0) if (this->receivedCounter.GetRate(now) == 0)
healthy = false; this->healthy = false;
else
this->healthy = true;
this->listener->OnRtpStreamHealthReport(this, healthy); this->listener->OnRtpStreamHealthReport(this, this->healthy);
} }
void RtpStreamRecv::OnNackGeneratorNackRequired(const std::vector<uint16_t>& seqNumbers) void RtpStreamRecv::OnNackGeneratorNackRequired(const std::vector<uint16_t>& seqNumbers)
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论