Documentation
¶
Index ¶
- Constants
- type Synchronizer
- func (s *Synchronizer) AddTrack(track TrackRemote, identity string) *TrackSynchronizer
- func (s *Synchronizer) End()
- func (s *Synchronizer) GetEndedAt() int64
- func (s *Synchronizer) GetStartedAt() int64
- func (s *Synchronizer) OnRTCP(packet rtcp.Packet)
- func (s *Synchronizer) RemoveTrack(trackID string)
- type SynchronizerConfig
- type SynchronizerOption
- type TrackRemote
- type TrackSynchronizer
Constants ¶
const (
DefaultMaxTsDiff = time.Minute
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Synchronizer ¶
a single Synchronizer is shared between all audio and video writers
func NewSynchronizer ¶
func NewSynchronizer(onStarted func()) *Synchronizer
func NewSynchronizerWithOptions ¶ added in v2.10.0
func NewSynchronizerWithOptions(opts ...SynchronizerOption) *Synchronizer
func (*Synchronizer) AddTrack ¶
func (s *Synchronizer) AddTrack(track TrackRemote, identity string) *TrackSynchronizer
func (*Synchronizer) End ¶
func (s *Synchronizer) End()
func (*Synchronizer) GetEndedAt ¶
func (s *Synchronizer) GetEndedAt() int64
func (*Synchronizer) GetStartedAt ¶
func (s *Synchronizer) GetStartedAt() int64
func (*Synchronizer) OnRTCP ¶
func (s *Synchronizer) OnRTCP(packet rtcp.Packet)
OnRTCP syncs a/v using sender reports
func (*Synchronizer) RemoveTrack ¶
func (s *Synchronizer) RemoveTrack(trackID string)
type SynchronizerConfig ¶ added in v2.10.0
type SynchronizerConfig struct {
MaxTsDiff time.Duration
OnStarted func()
AudioPTSAdjustmentDisabled bool
}
SynchronizerConfig holds configuration for the Synchronizer
type SynchronizerOption ¶ added in v2.10.0
type SynchronizerOption func(*SynchronizerConfig)
func WithAudioPTSAdjustmentDisabled ¶ added in v2.11.3
func WithAudioPTSAdjustmentDisabled() SynchronizerOption
WithAudioPTSAdjustmentDisabled - disables auto PTS adjustments after sender reports Use case: when media processing pipeline needs stable - monotonically increasing PTS sequence - small adjustments coming from RTCP sender reports could cause gaps in the audio Media processing pipeline could opt out of auto PTS adjustments and handle the gap by e.g modifying tempo to compensate instead
func WithMaxTsDiff ¶ added in v2.10.0
func WithMaxTsDiff(maxTsDiff time.Duration) SynchronizerOption
WithMaxTsDiff sets the maximum acceptable difference between RTP packets In case exceeded the synchronizer will adjust the PTS offset to keep the audio and video in sync
func WithOnStarted ¶ added in v2.10.0
func WithOnStarted(onStarted func()) SynchronizerOption
WithOnStarted sets the callback to be called when the synchronizer starts
type TrackRemote ¶
type TrackRemote interface {
ID() string
Codec() webrtc.RTPCodecParameters
Kind() webrtc.RTPCodecType
SSRC() webrtc.SSRC
}
type TrackSynchronizer ¶
func (*TrackSynchronizer) GetPTS ¶
GetPTS will reset sequence numbers and/or offsets if necessary Packets are expected to be in order
func (*TrackSynchronizer) Initialize ¶
func (t *TrackSynchronizer) Initialize(pkt *rtp.Packet)
Initialize should be called as soon as the first packet is received
func (*TrackSynchronizer) OnSenderReport ¶ added in v2.8.2
func (t *TrackSynchronizer) OnSenderReport(f func(drift time.Duration))