Upstream commit: https://webrtc.googlesource.com/src/+/eee78e7541901da05e34dd5301f3609a8bd9b30f Reland "Use Clock in internal EventTracer" This is a reland of commit ed6507b57e55cd3f1b590f0ae7df2c6bcab3c699 Reland safe: Use comment to deprecate rather than annotation Original change's description: > Use Clock in internal EventTracer > > This requires changes to X11 capturers due to a poorly defined macro in > X11. > > Bug: webrtc:42223992 > Change-Id: If9f8102386dc93142f9facfba21deb1f6a6a6964 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/445903 > Auto-Submit: Evan Shrubsole <eshr@webrtc.org> > Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org> > Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> > Commit-Queue: Evan Shrubsole <eshr@webrtc.org> > Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org> > Cr-Commit-Position: refs/heads/main@{#46819} Bug: webrtc:42223992 Change-Id: Ied9d07950cd35f132c17c3532581b5197a0fbfb1 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/446780 Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org> Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org> Auto-Submit: Evan Shrubsole <eshr@webrtc.org> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/main@{#46832}
119 lines
4.8 KiB
Diff
119 lines
4.8 KiB
Diff
From: Andreas Pehrson <apehrson@mozilla.com>
|
|
Date: Tue, 2 Nov 2021 14:35:00 +0000
|
|
Subject: Bug 1729455 - Inject RTCStatsTimestampMakerRealtimeClock into Call
|
|
instances. r=bwc
|
|
|
|
This patch makes libwebrtc use our clock for timestamps.
|
|
It also makes sure there's no use of the libwebrtc realtime clock, other than
|
|
for relative time tracking (like timeouts), and that future libwebrtc updates
|
|
don't introduce unaudited use of it.
|
|
|
|
Differential Revision: https://phabricator.services.mozilla.com/D127714
|
|
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/0744d68b8c944e69945de4ac5c4ca71332e78ad8
|
|
---
|
|
modules/rtp_rtcp/include/flexfec_receiver.h | 2 ++
|
|
modules/rtp_rtcp/source/flexfec_receiver.cc | 2 ++
|
|
rtc_base/event_tracer.cc | 2 +-
|
|
rtc_base/task_utils/repeating_task.h | 4 ++--
|
|
system_wrappers/include/clock.h | 2 +-
|
|
system_wrappers/source/clock.cc | 2 +-
|
|
6 files changed, 9 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/modules/rtp_rtcp/include/flexfec_receiver.h b/modules/rtp_rtcp/include/flexfec_receiver.h
|
|
index a869c8ad41..b6a33882d1 100644
|
|
--- a/modules/rtp_rtcp/include/flexfec_receiver.h
|
|
+++ b/modules/rtp_rtcp/include/flexfec_receiver.h
|
|
@@ -30,9 +30,11 @@ class Clock;
|
|
|
|
class FlexfecReceiver {
|
|
public:
|
|
+ /* Mozilla: Avoid this since it could use GetRealTimeClock().
|
|
FlexfecReceiver(uint32_t ssrc,
|
|
uint32_t protected_media_ssrc,
|
|
RecoveredPacketReceiver* recovered_packet_receiver);
|
|
+ */
|
|
FlexfecReceiver(Clock* clock,
|
|
uint32_t ssrc,
|
|
uint32_t protected_media_ssrc,
|
|
diff --git a/modules/rtp_rtcp/source/flexfec_receiver.cc b/modules/rtp_rtcp/source/flexfec_receiver.cc
|
|
index bde365fe18..5df6b2a8af 100644
|
|
--- a/modules/rtp_rtcp/source/flexfec_receiver.cc
|
|
+++ b/modules/rtp_rtcp/source/flexfec_receiver.cc
|
|
@@ -38,6 +38,7 @@ constexpr TimeDelta kPacketLogInterval = TimeDelta::Seconds(10);
|
|
|
|
} // namespace
|
|
|
|
+/* Mozilla: Avoid this since it could use GetRealTimeClock().
|
|
FlexfecReceiver::FlexfecReceiver(
|
|
uint32_t ssrc,
|
|
uint32_t protected_media_ssrc,
|
|
@@ -46,6 +47,7 @@ FlexfecReceiver::FlexfecReceiver(
|
|
ssrc,
|
|
protected_media_ssrc,
|
|
recovered_packet_receiver) {}
|
|
+ */
|
|
|
|
FlexfecReceiver::FlexfecReceiver(
|
|
Clock* clock,
|
|
diff --git a/rtc_base/event_tracer.cc b/rtc_base/event_tracer.cc
|
|
index dd8e293a06..0e6bca7a2c 100644
|
|
--- a/rtc_base/event_tracer.cc
|
|
+++ b/rtc_base/event_tracer.cc
|
|
@@ -121,7 +121,7 @@ class EventLogger final {
|
|
public:
|
|
explicit EventLogger(std::optional<Environment> env)
|
|
: env_(env),
|
|
- clock_(env.has_value() ? env->clock() : *Clock::GetRealTimeClock()) {}
|
|
+ clock_(env.has_value() ? env->clock() : *Clock::GetRealTimeClockRaw()) {}
|
|
~EventLogger() { RTC_DCHECK(thread_checker_.IsCurrent()); }
|
|
|
|
void AddTraceEvent(const char* name,
|
|
diff --git a/rtc_base/task_utils/repeating_task.h b/rtc_base/task_utils/repeating_task.h
|
|
index 3f738fcebc..d9536b71be 100644
|
|
--- a/rtc_base/task_utils/repeating_task.h
|
|
+++ b/rtc_base/task_utils/repeating_task.h
|
|
@@ -57,7 +57,7 @@ class RepeatingTaskHandle {
|
|
absl::AnyInvocable<TimeDelta()> closure,
|
|
TaskQueueBase::DelayPrecision precision =
|
|
TaskQueueBase::DelayPrecision::kLow,
|
|
- Clock* clock = Clock::GetRealTimeClock(),
|
|
+ Clock* clock = Clock::GetRealTimeClockRaw(),
|
|
const Location& location = Location::Current());
|
|
|
|
// DelayedStart is equivalent to Start except that the first invocation of the
|
|
@@ -68,7 +68,7 @@ class RepeatingTaskHandle {
|
|
absl::AnyInvocable<TimeDelta()> closure,
|
|
TaskQueueBase::DelayPrecision precision =
|
|
TaskQueueBase::DelayPrecision::kLow,
|
|
- Clock* clock = Clock::GetRealTimeClock(),
|
|
+ Clock* clock = Clock::GetRealTimeClockRaw(),
|
|
const Location& location = Location::Current());
|
|
|
|
// Stops future invocations of the repeating task closure. Can only be called
|
|
diff --git a/system_wrappers/include/clock.h b/system_wrappers/include/clock.h
|
|
index 52457f3dcf..fd367cb238 100644
|
|
--- a/system_wrappers/include/clock.h
|
|
+++ b/system_wrappers/include/clock.h
|
|
@@ -67,7 +67,7 @@ class RTC_EXPORT Clock {
|
|
}
|
|
|
|
// Returns an instance of the real-time system clock implementation.
|
|
- static Clock* absl_nonnull GetRealTimeClock();
|
|
+ static Clock* absl_nonnull GetRealTimeClockRaw();
|
|
};
|
|
|
|
class SimulatedClock : public Clock {
|
|
diff --git a/system_wrappers/source/clock.cc b/system_wrappers/source/clock.cc
|
|
index cbfc652923..ec66661fa3 100644
|
|
--- a/system_wrappers/source/clock.cc
|
|
+++ b/system_wrappers/source/clock.cc
|
|
@@ -63,7 +63,7 @@ class RealTimeClock : public Clock {
|
|
}
|
|
};
|
|
|
|
-Clock* absl_nonnull Clock::GetRealTimeClock() {
|
|
+Clock* absl_nonnull Clock::GetRealTimeClockRaw() {
|
|
static Clock* const clock = new RealTimeClock();
|
|
return clock;
|
|
}
|