#include "cast/streaming/impl/clock_offset_estimator_impl.h"
#include <algorithm>
#include <memory>
#include <utility>
#include "platform/base/trivial_clock_traits.h"
namespace openscreen::cast {
namespace {
constexpr size_t kBoundUpdateWeight = …;
constexpr size_t kMaxEventTimesMapSize = …;
uint64_t MakeEventKey(RtpTimeTicks rtp, uint16_t packet_id, bool audio) { … }
}
std::unique_ptr<ClockOffsetEstimator> ClockOffsetEstimator::Create() { … }
ClockOffsetEstimatorImpl::ClockOffsetEstimatorImpl() = default;
ClockOffsetEstimatorImpl::ClockOffsetEstimatorImpl(
ClockOffsetEstimatorImpl&&) noexcept = default;
ClockOffsetEstimatorImpl& ClockOffsetEstimatorImpl::operator=(
ClockOffsetEstimatorImpl&&) = default;
ClockOffsetEstimatorImpl::~ClockOffsetEstimatorImpl() = default;
void ClockOffsetEstimatorImpl::OnFrameEvent(const FrameEvent& frame_event) { … }
void ClockOffsetEstimatorImpl::OnPacketEvent(const PacketEvent& packet_event) { … }
bool ClockOffsetEstimatorImpl::GetReceiverOffsetBounds(
Clock::duration& frame_bound,
Clock::duration& packet_bound) const { … }
std::optional<Clock::duration> ClockOffsetEstimatorImpl::GetEstimatedOffset()
const { … }
ClockOffsetEstimatorImpl::BoundCalculator::BoundCalculator() = default;
ClockOffsetEstimatorImpl::BoundCalculator::BoundCalculator(
BoundCalculator&&) noexcept = default;
ClockOffsetEstimatorImpl::BoundCalculator&
ClockOffsetEstimatorImpl::BoundCalculator::operator=(BoundCalculator&&) =
default;
ClockOffsetEstimatorImpl::BoundCalculator::~BoundCalculator() = default;
void ClockOffsetEstimatorImpl::BoundCalculator::SetSent(RtpTimeTicks rtp,
uint16_t packet_id,
bool audio,
Clock::time_point t) { … }
void ClockOffsetEstimatorImpl::BoundCalculator::SetReceived(
RtpTimeTicks rtp,
uint16_t packet_id,
bool audio,
Clock::time_point t) { … }
void ClockOffsetEstimatorImpl::BoundCalculator::UpdateBound(
Clock::time_point sent,
Clock::time_point received) { … }
void ClockOffsetEstimatorImpl::BoundCalculator::CheckUpdate(uint64_t key) { … }
}