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}
This commit is contained in:
Alessio Bazzica
2022-09-20 11:16:16 +02:00
committed by WebRTC LUCI CQ
parent 54d9f056c6
commit 56b96ffe6a
9 changed files with 123 additions and 40 deletions

View File

@ -94,6 +94,7 @@ rtc_library("rtp_packet_info") {
":rtp_headers",
":scoped_refptr",
"../rtc_base/system:rtc_export",
"units:time_delta",
"units:timestamp",
]
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]

View File

@ -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 @@ class RTC_EXPORT RtpPacketInfo {
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 @@ class RTC_EXPORT RtpPacketInfo {
// 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);

View File

@ -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, AbsoluteCaptureTime) {
}
TEST(RtpPacketInfoTest, LocalCaptureClockOffset) {
constexpr absl::optional<int64_t> kValue = 10;
constexpr TimeDelta kValue = TimeDelta::Micros(8868963877546349045LL);
RtpPacketInfo lhs;
RtpPacketInfo rhs;

View File

@ -13,6 +13,7 @@ rtc_source_set("rtp_source") {
sources = [ "rtp_source.h" ]
deps = [
"../../../api:rtp_headers",
"../../../api/units:time_delta",
"../../../rtc_base:checks",
]
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]

View File

@ -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 @@ class RtpSource {
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 @@ class RtpSource {
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() &&