Avoid negative timestamp in SourceTracker.
Bug: b/364184684 Change-Id: If03cd697fed05c24549b9ef80bbaf9f11b47d8bc Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/361640 Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org> Cr-Commit-Position: refs/heads/main@{#42959}
This commit is contained in:
parent
3047e6449a
commit
6255a7f3a0
@ -94,6 +94,9 @@ SourceTracker::SourceEntry& SourceTracker::UpdateEntry(const SourceKey& key) {
|
||||
}
|
||||
|
||||
void SourceTracker::PruneEntries(Timestamp now) const {
|
||||
if (now < Timestamp::Zero() + kTimeout) {
|
||||
return;
|
||||
}
|
||||
Timestamp prune = now - kTimeout;
|
||||
while (!list_.empty() && list_.back().second.timestamp < prune) {
|
||||
map_.erase(list_.back().first);
|
||||
|
||||
@ -535,4 +535,12 @@ TEST(SourceTrackerTest, TimedOutSourcesAreRemoved) {
|
||||
kRtpTimestamp1, extensions1)));
|
||||
}
|
||||
|
||||
TEST(SourceTrackerTest, AvoidNegativeTimestamp) {
|
||||
SimulatedClock clock(Timestamp::Zero());
|
||||
SourceTracker tracker(&clock);
|
||||
tracker.OnFrameDelivered(RtpPacketInfos(
|
||||
{RtpPacketInfo(/*ssrc=*/111, /*csrcs=*/{}, /*rtp_timestamp=*/0,
|
||||
/*receive_time=*/Timestamp::Zero())}));
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user