poll

package
v0.0.0-...-455d0e3 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package poll implements a tick-based JPEG polling worker.

Instead of managing RTSP sessions directly, it polls go2rtc's HTTP API for pre-decoded JPEG frames. This eliminates H264 NAL assembly, GOP buffering, and the ffmpeg subprocess used by the previous approach.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JPEGFetcher

type JPEGFetcher interface {
	FetchJPEG(ctx context.Context, name string) ([]byte, error)
}

JPEGFetcher retrieves raw JPEG bytes for a named stream. The go2rtc Client satisfies this interface.

type Publisher

type Publisher interface {
	Publish(ctx context.Context, meta *pb.FrameReady, jpegIn []byte) error
}

Publisher uploads frames and publishes stream metadata. media.Publisher satisfies this interface.

type Worker

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

Worker polls go2rtc at a fixed interval, gates on motion, and publishes motion-bearing frames to MinIO + Redis Streams.

func NewWorker

func NewWorker(
	cam config.CameraConfig,
	fetcher JPEGFetcher,
	gate *motion.Gate,
	pub Publisher,
	log *zap.Logger,
) *Worker

NewWorker creates a Worker for the given camera.

func (*Worker) Run

func (w *Worker) Run(ctx context.Context)

Run polls go2rtc until ctx is cancelled.

Jump to

Keyboard shortcuts

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