Source code

Revision control

Copy as Markdown

Other Tools

From: Nico Grunbaum <na-g@nostrum.com>
Date: Mon, 26 Jul 2021 22:51:00 -0700
Subject: Bug 1654112 - fix timestamp issues with RTP sources; r=mjf
---
modules/rtp_rtcp/source/source_tracker.cc | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/modules/rtp_rtcp/source/source_tracker.cc b/modules/rtp_rtcp/source/source_tracker.cc
index cd881f1443..d2bea8b0e4 100644
--- a/modules/rtp_rtcp/source/source_tracker.cc
+++ b/modules/rtp_rtcp/source/source_tracker.cc
@@ -52,7 +52,8 @@ void SourceTracker::OnFrameDeliveredInternal(
SourceKey key(RtpSourceType::CSRC, csrc);
SourceEntry& entry = UpdateEntry(key);
- entry.timestamp = now;
+ const auto packet_time = packet_info.receive_time();
+ entry.timestamp = packet_time.ms() ? packet_time : now;
entry.audio_level = packet_info.audio_level();
entry.absolute_capture_time = packet_info.absolute_capture_time();
entry.local_capture_clock_offset =
@@ -91,6 +92,10 @@ std::vector<RtpSource> SourceTracker::GetSources() const {
.local_capture_clock_offset = entry.local_capture_clock_offset});
}
+ std::sort(sources.begin(), sources.end(), [](const auto &a, const auto &b){
+ return a.timestamp().ms() > b.timestamp().ms();
+ });
+
return sources;
}