pubsim

package
v0.41.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package pubsim is the synthetic fixture publisher behind cmd/gawk-pubsim (R20, docs/25 Decision 3): the committed H.264 fixture demuxed into access units once, then looped through the real engine at a live pace. It exists so CI (and the manual W6 scale drill) has a deterministic broadcaster that is not a gaming PC — same engine, same wire bytes, no GPU, no portal.

Index

Constants

View Source
const MagentaPhaseFrames = 1350

MagentaPhaseFrames is how many frames each phase of the `-fixture magenta` loop lasts: 1350, which is 45 s at gawk-pubsim's default 30 fps (other rates scale it, like the fixture's keyframe cadence). R40's end-to-end check (docs/71 CF8) needs ONE publisher session whose screening window trips and later clears; at the sampler's 5 s interval each phase is ~9 samples, comfortably more than the default 6-sample window, and each phase stays long enough (≥ 40 s) for a reasonably stretched interval to see it. The dev stack and the e2e assertions rely on this length.

Variables

This section is empty.

Functions

func Demux

func Demux(ts []byte) ([]publisher.AccessUnit, error)

Demux turns a raw MPEG-TS stream into engine access units, exactly as the relay integration test's fixtureSource does: bytes cloned per AU, keyframes flagged by the IDR sniff.

func Factory

func Factory(aus []publisher.AccessUnit, fps int, packets [][]byte) publisher.MediaSourceFactory

Factory adapts a demuxed AU list into the engine's media-source seam. The engine calls it with its own Clock, which is what makes the frame stamps and TimeSync read one timeline (docs/19 Decision 6) — pubsim must not weaken that invariant just because its frames are canned.

packets non-empty makes the source implement publisher.AudioSource as well (R25, docs/28 Decision 12). Empty leaves it video-only, which is not a degraded shape but the one R20 tier-1 asserts continuously — hence the -audio flag defaulting to off.

func PhasedLoop added in v0.33.0

func PhasedLoop(aus []publisher.AccessUnit, phaseFrames int) ([]publisher.AccessUnit, error)

PhasedLoop builds the `-fixture magenta` sequence from the demuxed TSMagenta clip: its first half (solid magenta) repeated to phaseFrames, then its second half (solid grey) repeated to phaseFrames. Source loops the result, so the published stream alternates the two phases forever.

Halves are repeated whole, and each half must start with a keyframe, so every repetition is a closed set of GOPs: a decoder joining anywhere — the relay's cached keyframe is all R40's sampler ever decodes — sees a valid stream. Access units are shared, not copied; the engine never writes them.

Types

type Source

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

Source is an publisher.MediaSource that replays a fixed AU sequence in a loop at a steady rate, forever, stamping each AU with the live clock at emit time. The fixture's own timeline never leaks: live-edge drift and the ClockMapping math on the viewer side read TimestampUs, and replayed stamps from a 2-second file would wrap those instruments around nonsense.

func NewSource

func NewSource(aus []publisher.AccessUnit, fps int, clock publisher.Clock) (*Source, error)

NewSource builds a Source pacing aus at fps. The keyframe cadence follows the fixture (every 15 AUs → 500 ms at 30 fps; other rates scale it).

func (*Source) CapturePath

func (s *Source) CapturePath() string

func (*Source) Encoder

func (s *Source) Encoder() string

func (*Source) Err

func (s *Source) Err() error

func (*Source) Start

func (s *Source) Start(ctx context.Context) (<-chan publisher.AccessUnit, error)

func (*Source) Stop

func (s *Source) Stop() error

Directories

Path Synopsis
Package fixture holds the committed H.264 MPEG-TS test stream (see README.md for its provenance and the properties tests depend on).
Package fixture holds the committed H.264 MPEG-TS test stream (see README.md for its provenance and the properties tests depend on).
Package mpegts is a deliberately minimal MPEG-TS demuxer: enough to recover access-unit boundaries from the GStreamer child's stdout, and nothing more.
Package mpegts is a deliberately minimal MPEG-TS demuxer: enough to recover access-unit boundaries from the GStreamer child's stdout, and nothing more.
Package opus reads the one byte of an Opus packet that describes the packet: its TOC (RFC 6716 §3.1).
Package opus reads the one byte of an Opus packet that describes the packet: its TOC (RFC 6716 §3.1).

Jump to

Keyboard shortcuts

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