Rewrite tmmbr timeout check to avoid using negative Timestamp

Bug: chromium:1511139
Change-Id: I7f65fd07412a6c32c5633f8ef6655ba506fe5407
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/331822
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Auto-Submit: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41404}
This commit is contained in:
Danil Chapovalov 2023-12-18 14:01:00 +01:00 committed by WebRTC LUCI CQ
parent e0e03ba73a
commit ca8353648d

View File

@ -1173,11 +1173,11 @@ std::vector<rtcp::TmmbItem> RTCPReceiver::TmmbrReceived() {
MutexLock lock(&rtcp_receiver_lock_);
std::vector<rtcp::TmmbItem> candidates;
Timestamp timeout = clock_->CurrentTime() - kTmmbrTimeoutInterval;
Timestamp now = clock_->CurrentTime();
for (auto& kv : tmmbr_infos_) {
for (auto it = kv.second.tmmbr.begin(); it != kv.second.tmmbr.end();) {
if (it->second.last_updated < timeout) {
if (now - it->second.last_updated > kTmmbrTimeoutInterval) {
// Erase timeout entries.
it = kv.second.tmmbr.erase(it);
} else {