From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- dom/media/webrtc/libwebrtcglue/SystemTime.h | 44 +++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 dom/media/webrtc/libwebrtcglue/SystemTime.h (limited to 'dom/media/webrtc/libwebrtcglue/SystemTime.h') diff --git a/dom/media/webrtc/libwebrtcglue/SystemTime.h b/dom/media/webrtc/libwebrtcglue/SystemTime.h new file mode 100644 index 0000000000..5c042e689f --- /dev/null +++ b/dom/media/webrtc/libwebrtcglue/SystemTime.h @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:set ts=2 sw=2 sts=2 et cindent: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef DOM_MEDIA_WEBRTC_LIBWEBRTCGLUE_SYSTEMTIMENANOS_H_ +#define DOM_MEDIA_WEBRTC_LIBWEBRTCGLUE_SYSTEMTIMENANOS_H_ + +#include "jsapi/RTCStatsReport.h" +#include "mozilla/TimeStamp.h" +#include "system_wrappers/include/clock.h" + +namespace mozilla { +class RTCStatsTimestampMakerRealtimeClock : public webrtc::Clock { + public: + explicit RTCStatsTimestampMakerRealtimeClock( + const dom::RTCStatsTimestampMaker& aTimestampMaker); + + webrtc::Timestamp CurrentTime() override; + + // Upstream, this method depend on rtc::TimeUTCMicros for converting the + // monotonic system clock to Ntp, if only for the first call when deciding the + // Ntp offset. + // We override this to be able to use our own clock instead of + // rtc::TimeUTCMicros for ntp timestamps. + webrtc::NtpTime ConvertTimestampToNtpTime( + webrtc::Timestamp aRealtime) override; + + const dom::RTCStatsTimestampMaker mTimestampMaker; +}; + +// The time base used for WebrtcSystemTime(). Completely arbitrary. Constant. +TimeStamp WebrtcSystemTimeBase(); + +// The returned timestamp denotes the monotonic time passed since +// WebrtcSystemTimeBase(). Libwebrtc uses this to track how time advances from a +// specific point in time. It adds an offset to make the timestamps absolute. +webrtc::Timestamp WebrtcSystemTime(); + +webrtc::NtpTime CreateNtp(webrtc::Timestamp aTime); +} // namespace mozilla + +#endif -- cgit v1.2.3