Commit 7e646761 by Johnny

refine: rename TwccContext::checkIfNeedSendTwcc to TwccContext::needSendTwcc.

parent da0a7219
...@@ -38,25 +38,17 @@ void TwccContext::onRtp(uint32_t ssrc, uint16_t twcc_ext_seq, uint64_t stamp_ms) ...@@ -38,25 +38,17 @@ void TwccContext::onRtp(uint32_t ssrc, uint16_t twcc_ext_seq, uint64_t stamp_ms)
_min_stamp = _max_stamp; _min_stamp = _max_stamp;
} }
if (checkIfNeedSendTwcc()) { if (needSendTwcc()) {
//其他匹配条件立即发送twcc //其他匹配条件立即发送twcc
onSendTwcc(ssrc); onSendTwcc(ssrc);
} }
} }
bool TwccContext::checkIfNeedSendTwcc() const { bool TwccContext::needSendTwcc() const {
auto size = _rtp_recv_status.size(); if (_rtp_recv_status.empty()) {
if (!size) {
return false; return false;
} }
if (size >= kMaxSeqDelta) { return (_rtp_recv_status.size() >= kMaxSeqSize) || (_max_stamp - _min_stamp >= kMaxTimeDelta);
return true;
}
auto delta_ms = _max_stamp - _min_stamp;
if (delta_ms >= kMaxTimeDelta) {
return true;
}
return false;
} }
int TwccContext::checkSeqStatus(uint16_t twcc_ext_seq) const { int TwccContext::checkSeqStatus(uint16_t twcc_ext_seq) const {
......
...@@ -21,7 +21,7 @@ class TwccContext { ...@@ -21,7 +21,7 @@ class TwccContext {
public: public:
using onSendTwccCB = function<void(uint32_t ssrc, string fci)>; using onSendTwccCB = function<void(uint32_t ssrc, string fci)>;
//每个twcc rtcp包最多表明的rtp ext seq增量 //每个twcc rtcp包最多表明的rtp ext seq增量
static constexpr size_t kMaxSeqDelta = 20; static constexpr size_t kMaxSeqSize = 20;
//每个twcc rtcp包发送的最大时间间隔,单位毫秒 //每个twcc rtcp包发送的最大时间间隔,单位毫秒
static constexpr size_t kMaxTimeDelta = 256; static constexpr size_t kMaxTimeDelta = 256;
...@@ -33,7 +33,7 @@ public: ...@@ -33,7 +33,7 @@ public:
private: private:
void onSendTwcc(uint32_t ssrc); void onSendTwcc(uint32_t ssrc);
bool checkIfNeedSendTwcc() const; bool needSendTwcc() const;
int checkSeqStatus(uint16_t twcc_ext_seq) const; int checkSeqStatus(uint16_t twcc_ext_seq) const;
void clearStatus(); void clearStatus();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论