Documentation
¶
Overview ¶
Package playbackbuffer retains completed encoder output for a surviving delivery controller. It owns neither encoder lifecycle nor client playback state.
Index ¶
- type Budget
- type Facts
- type Format
- type FreezeToken
- type Key
- type Kind
- type Lease
- type Limits
- type Metadata
- type RetainedIdentity
- type Snapshot
- type State
- type Store
- func (s *Store) AbortTransition(t *FreezeToken) error
- func (s *Store) Acquire(k Key) (*Lease, error)
- func (s *Store) AdvanceGeneration(id string, expected State, generation uint64) error
- func (s *Store) CloseSession(id string) error
- func (s *Store) Delete(k Key) error
- func (s *Store) FreezeGeneration(id string, expected State, next State) (*FreezeToken, error)
- func (s *Store) OpenSession(id string, initial State) error
- func (s *Store) Publish(id string, expected State, keys []Key) error
- func (s *Store) PublishTransition(t *FreezeToken, keys []Key) error
- func (s *Store) Retain(ctx context.Context, k Key, f Format, n int64, r io.Reader) error
- func (s *Store) Snapshot(id string) (Snapshot, error)
- type TrackFacts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Facts ¶
type Facts struct {
Verified bool
Reason string
Tracks []TrackFacts
}
Facts describe container observations, not a decoder verdict or sample-end durations. Verified is deliberately false for unsupported formats, transport discontinuities, clock wrap, missing tracks, and structural parse failures. An initial per-PID discontinuity marker is a legal muxer reset, not an intra-segment discontinuity. MPEGTS timestamps are unsigned 33-bit ticks at exactly 90000 Hz. Wrap is rejected, never silently normalized against an unrelated generation.
type FreezeToken ¶
type FreezeToken struct {
// contains filtered or unexported fields
}
FreezeToken is opaque, store-specific and single-use. It grants no start or retirement authority. Its target generation is fixed at freeze time.
type Key ¶
Key identifies bytes permanently within a session lifetime. Generations must increase; callers must use a fresh session identity when reopening a session.
type Lease ¶
type Lease struct {
// contains filtered or unexported fields
}
Lease exposes copy-out reads only. Close waits for concurrent ReadAt calls and releases the pin. No method returns the store's mutable backing slice.
func (*Lease) Identity ¶
func (l *Lease) Identity() (RetainedIdentity, error)
Identity rechecks the pin, entry and current generation under the store lock. Old generation leases remain readable through ReadAt but cannot mint fresh recovery receipts after a transition. No parsed metadata is trusted here.
type RetainedIdentity ¶
RetainedIdentity describes an actual published entry and the live session state at inspection time. It is evidence, never a publication permission.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) AbortTransition ¶
func (s *Store) AbortTransition(t *FreezeToken) error
func (*Store) AdvanceGeneration ¶
AdvanceGeneration is a controller-authorized fixed-grid ownership change. The contiguous published prefix remains immutable and readable. Old staged bytes cannot publish after this CAS; the next generation begins at floor+1. This method does not certify media/audio continuity; the encoder resume contract and independent playback acceptance must establish those facts.
func (*Store) CloseSession ¶
func (*Store) Delete ¶
Delete only releases staged bytes. Published output is promised until the controller explicitly closes the session; there is no automatic eviction.
func (*Store) FreezeGeneration ¶
func (*Store) Publish ¶
Publish atomically exposes a contiguous batch from the current generation. Ordinary publication can expose unverified media; a recovery transition cannot.
func (*Store) PublishTransition ¶
func (s *Store) PublishTransition(t *FreezeToken, keys []Key) error
PublishTransition verifies advancing observed PES timestamps and independent starts on every track. It does NOT prove a gap-free sample-duration boundary, decodability, delivery, or seamless playback. Old publications remain readable.
func (*Store) Retain ¶
Retain reserves five times the declared size (bytes plus bounded parsing workspace) before reading, reduced to exact retained bytes on success. It and requires EOF immediately after it. Reader must honor ctx itself if its Read can block; no hidden reader goroutine is created. All failed reads release their reservation. Successful bytes are staged and cannot be acquired until Publish or PublishTransition.
type TrackFacts ¶
type TrackFacts struct {
PID uint16
StreamType byte
FirstPTS, LastPTS, FirstDTS, LastDTS int64
Independent bool
Config [32]byte
}
TrackFacts timestamps are the first and maximum observed PES PTS and first/last PES DTS, not every access-unit timestamp. In particular an AAC PES can contain several ADTS frames after LastPTS. No sample-end time is inferred.