提交 4241bafd authored 作者: José Luis Millán's avatar José Luis Millán

Fix #186. NackGenerator code being executed after instance deletion

上级 38da4d4e
......@@ -45,6 +45,7 @@ namespace RTC
bool ReceivePacket(RTC::RtpPacket* packet);
size_t GetNackListLength() const;
void Reset();
private:
void CleanOldNackItems(uint16_t seq);
......@@ -82,6 +83,18 @@ namespace RTC
{
return this->nackList.size();
}
inline void NackGenerator::Reset()
{
this->started = false;
this->lastSeq = 0;
this->rtt = 0;
this->nackList.clear();
this->keyFrameList.clear();
this->timer->Stop();
}
} // namespace RTC
#endif
......@@ -110,6 +110,11 @@ namespace RTC
}
AddPacketsToNackList(this->lastSeq + 1, seq);
// NackGenerator instance may have been reseted.
if (!this->started)
return false;
this->lastSeq = seq;
// Check if there are any nacks that are waiting for this seq number.
......
......@@ -211,7 +211,7 @@ namespace RTC
{
// Reset NackGenerator.
if (this->params.useNack)
this->nackGenerator.reset(new RTC::NackGenerator(this));
this->nackGenerator->Reset();
this->listener->OnRtpStreamRecvPliRequired(this);
}
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论