Documentation
¶
Overview ¶
Package frames serves a camera stream's access units over HTTP, one length-prefixed record per frame, for a client that owns its own decoder.
It exists for the cam wall. Every general-purpose player on the wall boxes sits one to three seconds behind the camera: RTSP jitter buffers, the container demux and the player's own render clock all add their share. A client that feeds access units straight into the hardware decoder and renders each picture as it comes out has none of those stages, and this is the simplest possible feed for it: no container, no RTP, no SDP, just the frames as the camera sent them, Annex B parameter sets inline.
Record layout, big-endian, 20 bytes then payload:
0 "RF" magic 2 u8 version, 1 3 u8 kind: 1 keyframe, 2 inter frame, 3 AAC 4 u8 codec: 1 H264, 2 H265, 3 AAC 5 u8 reserved 6 u16 width, 0 if not yet known 8 u16 height, 0 if not yet known 10 u32 camera microseconds (wraps every 71.6 minutes) 14 u32 payload length 18 u16 server send time, milliseconds since the epoch mod 65536
The send time lets a client with a synchronised clock measure the server-to-screen leg on its own, without a round trip and without trusting the camera's clock. It wraps every 65.5 seconds, which is far longer than any latency worth measuring.
A subscriber's first record is a keyframe, and a subscriber that falls behind is resumed at the next keyframe rather than handed a frame whose references it never saw. Nothing here blocks the camera goroutine.
Index ¶
Constants ¶
const ( HeaderLen = 20 Version = 1 KindKey = 1 KindInter = 2 KindAAC = 3 CodecH264 = 1 CodecH265 = 2 CodecAAC = 3 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Record ¶
Record is one decoded frame record.
func ReadRecord ¶
ReadRecord reads one record from r. It is what a Go client, or a test, uses; the wall's client is not written in Go.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server holds the feeds and serves them at "/<path>.frames".
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
Stream is one camera stream's feed. It implements stream.FrameSink and stream.ConnectionSink.