Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeriveSource ¶
DeriveSource buckets a requestType into "web" or "sdk", or "" if unknown.
func Dump ¶
func Dump()
Dump writes the collected stats as JSON to AVSYNC_STATS_PATH (default /tmp/avsync-stats.json), intended for t.Cleanup at the end of TestEgress.
func IntegerLag ¶
IntegerLag returns the candidate lag (0..maxIntLag) that best aligns actual buckets to expected plan slots. Smallest lag wins ties.
Types ¶
type Observation ¶
type Observation struct {
Buckets []*Bucket
Offset time.Duration
// contains filtered or unexported fields
}
Observation bins detected beeps and flashes by integer second of recording PTS. Offset is the global median fractional offset; beepRefs/flashRefs are per-participant medians used by hasOutlier (so systematic cross-track/cross-participant offsets don't block stabilization — those are measured separately as av-sync).
func Quantize ¶
func Quantize(result *avsync.Result) *Observation
Quantize bins beeps/flashes from the analyzer result into per-second Buckets centered on the median fractional PTS offset.
func (*Observation) TimeToStabilize ¶
func (obs *Observation) TimeToStabilize() (int, time.Duration)
TimeToStabilize finds the first run of 3 consecutive non-empty non-outlier buckets and returns (bucketIndex, earliestPTS), or (-1, 0) if no such run exists. Empty buckets are skipped entirely: they don't count toward the run, but don't reset it either (so intentional silence in multi-participant recordings is tolerated).
type Stats ¶
type Stats struct {
// Identity
IntegrationType string
Test string
RequestType string
Source string
Output string
Format string
AudioCodec string
VideoCodec string
Layout string
AudioOnly bool
VideoOnly bool
Tracks int
// Sanity counters
FlashCount int
BeepCount int
// Stabilization
Locked bool
TimeToStable time.Duration
// Post-stable steady state
AudioJitter time.Duration
VideoJitter time.Duration
StableAVSync time.Duration // signed; positive = video lags audio
AVSyncStdDev time.Duration
MaxAVSync time.Duration
// Composite
Score float64
}
Stats is one row of metrics per output (file/stream/segments). Identity fields are set by the caller; Compute fills in the rest.
func Compute ¶
func Compute(obs *Observation, audioOnly, videoOnly bool) Stats
Compute derives stats from the quantized Observation. audioOnly / videoOnly come from the recording's intended track set and shape the score (missing video isn't penalized in audio-only outputs).