Surface `local_capture_clock_offset` from `RtpSource`

- Propagating `RtpPacketInfo::local_capture_clock_offset`, an
  existing field that is related to the abs-capture-timestamp
  header extension field `estimated_capture_clock_offset`
- Propagated through `SourceTracker::SourceEntry`

Bug: webrtc:10739, b/246753278
Change-Id: I21d9841e4f3a35da5f8d7b31582898309421d524
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/275241
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38129}
diff --git a/api/BUILD.gn b/api/BUILD.gn
index e9db503..10337cb 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -94,6 +94,7 @@
     ":rtp_headers",
     ":scoped_refptr",
     "../rtc_base/system:rtc_export",
+    "units:time_delta",
     "units:timestamp",
   ]
   absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
diff --git a/api/rtp_packet_info.h b/api/rtp_packet_info.h
index f9980a1..bc8784c 100644
--- a/api/rtp_packet_info.h
+++ b/api/rtp_packet_info.h
@@ -17,6 +17,7 @@
 
 #include "absl/types/optional.h"
 #include "api/rtp_headers.h"
+#include "api/units/time_delta.h"
 #include "api/units/timestamp.h"
 #include "rtc_base/system/rtc_export.h"
 
@@ -92,11 +93,11 @@
     return *this;
   }
 
-  const absl::optional<int64_t>& local_capture_clock_offset() const {
+  const absl::optional<TimeDelta>& local_capture_clock_offset() const {
     return local_capture_clock_offset_;
   }
   RtpPacketInfo& set_local_capture_clock_offset(
-      const absl::optional<int64_t>& value) {
+      absl::optional<TimeDelta> value) {
     local_capture_clock_offset_ = value;
     return *this;
   }
@@ -117,16 +118,14 @@
 
   // Fields from the Absolute Capture Time header extension:
   // http://www.webrtc.org/experiments/rtp-hdrext/abs-capture-time
-  // To not be confused with `local_capture_clock_offset_`, the
-  // `estimated_capture_clock_offset` in `absolute_capture_time_` should
-  // represent the clock offset between a remote sender and the capturer, and
-  // thus equals to the corresponding values in the received RTP packets,
-  // subjected to possible interpolations.
   absl::optional<AbsoluteCaptureTime> absolute_capture_time_;
 
-  // Clock offset against capturer's clock. Should be derived from the estimated
-  // capture clock offset defined in the Absolute Capture Time header extension.
-  absl::optional<int64_t> local_capture_clock_offset_;
+  // Clock offset between the local clock and the capturer's clock.
+  // Do not confuse with `AbsoluteCaptureTime::estimated_capture_clock_offset`
+  // which instead represents the clock offset between a remote sender and the
+  // capturer. The following holds:
+  //   Capture's NTP Clock = Local NTP Clock + Local-Capture Clock Offset
+  absl::optional<TimeDelta> local_capture_clock_offset_;
 };
 
 bool operator==(const RtpPacketInfo& lhs, const RtpPacketInfo& rhs);
diff --git a/api/rtp_packet_info_unittest.cc b/api/rtp_packet_info_unittest.cc
index 80abccc..d35edf7 100644
--- a/api/rtp_packet_info_unittest.cc
+++ b/api/rtp_packet_info_unittest.cc
@@ -9,6 +9,7 @@
  */
 
 #include "api/rtp_packet_infos.h"
+#include "api/units/time_delta.h"
 #include "test/gmock.h"
 #include "test/gtest.h"
 
@@ -186,7 +187,7 @@
 }
 
 TEST(RtpPacketInfoTest, LocalCaptureClockOffset) {
-  constexpr absl::optional<int64_t> kValue = 10;
+  constexpr TimeDelta kValue = TimeDelta::Micros(8868963877546349045LL);
 
   RtpPacketInfo lhs;
   RtpPacketInfo rhs;
diff --git a/api/transport/rtp/BUILD.gn b/api/transport/rtp/BUILD.gn
index 26036c7..205bbcc 100644
--- a/api/transport/rtp/BUILD.gn
+++ b/api/transport/rtp/BUILD.gn
@@ -13,6 +13,7 @@
   sources = [ "rtp_source.h" ]
   deps = [
     "../../../api:rtp_headers",
+    "../../../api/units:time_delta",
     "../../../rtc_base:checks",
   ]
   absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
diff --git a/api/transport/rtp/rtp_source.h b/api/transport/rtp/rtp_source.h
index c19cfeb..e51dcd7 100644
--- a/api/transport/rtp/rtp_source.h
+++ b/api/transport/rtp/rtp_source.h
@@ -15,6 +15,7 @@
 
 #include "absl/types/optional.h"
 #include "api/rtp_headers.h"
+#include "api/units/time_delta.h"
 #include "rtc_base/checks.h"
 
 namespace webrtc {
@@ -28,7 +29,17 @@
  public:
   struct Extensions {
     absl::optional<uint8_t> audio_level;
+
+    // Fields from the Absolute Capture Time header extension:
+    // http://www.webrtc.org/experiments/rtp-hdrext/abs-capture-time
     absl::optional<AbsoluteCaptureTime> absolute_capture_time;
+
+    // Clock offset between the local clock and the capturer's clock.
+    // Do not confuse with `AbsoluteCaptureTime::estimated_capture_clock_offset`
+    // which instead represents the clock offset between a remote sender and the
+    // capturer. The following holds:
+    //   Capture's NTP Clock = Local NTP Clock + Local-Capture Clock Offset
+    absl::optional<TimeDelta> local_capture_clock_offset;
   };
 
   RtpSource() = delete;
@@ -74,6 +85,10 @@
     return extensions_.absolute_capture_time;
   }
 
+  absl::optional<TimeDelta> local_capture_clock_offset() const {
+    return extensions_.local_capture_clock_offset;
+  }
+
   bool operator==(const RtpSource& o) const {
     return timestamp_ms_ == o.timestamp_ms() && source_id_ == o.source_id() &&
            source_type_ == o.source_type() &&