Files
server-sdk-go/pkg/synchronizer/errors.go
Raja Subramanian bb890d1748 Use a one-way-delay estimator to estimate propagation delay. (#741)
* Use a one-way-delay estimator to estimate propagation delay.

- Use receive time of packet for star time. This allows packets pulled
  late from jitter buffer to have a good start time.
- Use one-way-delay estimator to estimate propagation delay between
  sender and receiver. And rebase sender NTP time using that so that
  operations are in local clock domain.
- Based on rebased sender report, adjust start time for the first two
  minutes to get a good estimate of start time. This will make
  subsequent PTS calculations more reliable.
- Ensure that PTS is alweys moving forward.

* point to PR hash

* get test to compile, still fails a couple

* more logging

* log sr

* rebase PTS

* lower threshold for high offset logging

* log rebasedPTS

* log adjustment skip

* last time

* log offsets

* range

* log adjustment

* log change

* initial adjustment

* log normal offset also

* flip side

* no rebase of PTS

* flag to choose with or without rebase

* missed file

* more adjustement

* handle same frame packets

* HandlerCloser interface

* deps

* clean up

* fix tests

* deps

* Revert PTS max adjustment to 5ms as smaller values produce a lot of artifacts

* log config

* parameterise drift adjustments
2025-09-30 18:53:34 +05:30

25 lines
752 B
Go

// Copyright 2023 LiveKit, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package synchronizer
import (
"errors"
)
var (
ErrPacketOutOfOrder = errors.New("packet out-of-order")
ErrPacketTooOld = errors.New("packet too old")
)