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 ¶
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) ([]engine.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 []engine.AccessUnit, fps int, packets [][]byte) engine.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 engine.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 []engine.AccessUnit, phaseFrames int) ([]engine.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 engine.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 ¶
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 ¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package engine publishes encoded media to the relay using the same publisher protocol the browser broadcaster speaks — byte for byte, via the shared gawk-server/wire package.
|
Package engine publishes encoded media to the relay using the same publisher protocol the browser broadcaster speaks — byte for byte, via the shared gawk-server/wire package. |
|
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). |