Help us shape the future of Go! Take the 2026 Go Developer Survey

viewer

package
v0.16.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultPacketsPerSample is the default number of packets between stats
	// samples. LiveKit overrides this with 200 to match its lower-bitrate SVC
	// configuration; all other plugins use the default.
	DefaultPacketsPerSample = 1000

	// DefaultTrackBufferSize is the byte buffer length for reading RTP packets
	// from a track. Shared across all plugins.
	DefaultTrackBufferSize = 1500

	// DefaultPLIMinIntervalNS is the minimum nanoseconds between PLI sends
	// (100 ms). Shared across all plugins.
	DefaultPLIMinIntervalNS = 100_000_000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	PacketsPerSample  int    `json:"packets_per_sample"`
	VP9RTPPayloadType int    `json:"vp9_rtp_payload_type"`
	TrackBufferSize   int    `json:"track_buffer_size"`
	StatsBufferSize   int    `json:"stats_buffer_size"`
	PacketCaptureDir  string `json:"packet_capture_dir"` // if non-empty, write pcap file here
}

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(input chan<- vp9_stats.VideoQualitySample, log *log.Logger) *Manager

func (*Manager) HandleTrack

func (m *Manager) HandleTrack(
	track *webrtc.TrackRemote,
	receiver *webrtc.RTPReceiver,
	pub *vp9_stats.Publisher,
	opts TrackHandlerOpts,
) (*Viewer, error)

HandleTrack is the shared OnTrack handler. It sets up RTCP PLI throttling, builds a viewer Config, optionally creates an IvfSegmenter for recording, and spawns a Viewer. This replaces ~35 near-identical lines in each plugin.

func (*Manager) Size

func (m *Manager) Size() (n int)

func (*Manager) SpawnViewer

func (m *Manager) SpawnViewer(
	track *webrtc.TrackRemote,
	receiver *webrtc.RTPReceiver,
	nickname string,
	config *Config,
	ivf *vp9.IvfSegmenter,
	pub *vp9_stats.Publisher,
	rtcpTracker *vp9_stats.RTCPTracker,
	onFrameLost func(nowNano int64),
) (*Viewer, error)

func (*Manager) StopAll

func (m *Manager) StopAll()

type TrackHandlerOpts

type TrackHandlerOpts struct {
	StatsBufferSize    int
	PacketCaptureDir   string
	EnableRecording    bool
	RecordingDirectory string
	PacketsPerSample   int // 0 defaults to DefaultPacketsPerSample
	RoomID             string
	UserID             string
	Logger             *log.Logger
	SendPLI            func() // plugin-specific PLI sender
}

TrackHandlerOpts configures HandleTrack. Each plugin provides these values from its own config and transport layer.

type Viewer

type Viewer struct {
	// contains filtered or unexported fields
}

Viewer connects to a conference and receives 1 VP9 video stream

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL