Snapcast.Stream (Snapcast v0.1.1)

Copy Markdown View Source

Decodes one source to PCM and paces it out as timestamped WireChunks.

ffmpeg is used purely as a decoder: it floods raw signed little-endian PCM into a buffer as fast as it likes. The pacer owns the audio timeline — chunk N is stamped with start + N * chunk_ms (server clock) and emitted once realtime is within bufferMs of that play time. Because the server assigns the timestamps (not arrival order), there is no producer/consumer drift: the only requirement is to send a chunk before its play deadline, and the bufferMs lead absorbs all jitter.

source is a binary path/URL, or a 0-arity function returning one (resolved when the stream starts, e.g. for short-lived signed URLs).

Summary

Functions

Returns a specification to start this module under a supervisor.

The next timestamp this stream will use (µs), so a successor can continue the timeline.

Functions

attach(stream, session_pid)

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

high_water(stream)

The next timestamp this stream will use (µs), so a successor can continue the timeline.

start_link(opts)

stop(stream)