tracker

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SegmentForwardCallback

type SegmentForwardCallback func(ctxt context.Context, segment common.VideoSegmentWithData) error

SegmentForwardCallback function signature of callback to send out read video segments

type SourceHLSMonitor

type SourceHLSMonitor interface {
	/*
		Update update status of the HLS source based on information in the current playlist.

		IMPORTANT: The playlist must be from the HLS source being tracked.

			@param ctxt context.Context - execution context
			@param currentPlaylist hls.Playlist - the current playlist for the video source
			@param timestamp time.Time - timestamp of when this update is called
	*/
	Update(ctxt context.Context, currentPlaylist hls.Playlist, timestamp time.Time) error

	/*
		Stop stops the daemon process

			@param ctxt context.Context - execution context
	*/
	Stop(ctxt context.Context) error
}

SourceHLSMonitor daemon to monitor a single HLS video source and process its video segments as they update

func NewSourceHLSMonitor

func NewSourceHLSMonitor(
	parentContext context.Context,
	source common.VideoSource,
	dbConns db.ConnectionManager,
	trackingWindow time.Duration,
	segmentCache utils.VideoSegmentCache,
	reader utils.SegmentReader,
	forwardSegment SegmentForwardCallback,
	metrics goutils.MetricsCollector,
) (SourceHLSMonitor, error)

NewSourceHLSMonitor define new single HLS source monitor

Tracking window is the duration in time a video segment is tracked. After observing a new segment, that segment is remembered for the duration of a tracking window, and forgotten after that.

@param parentContext context.Context - context from which to define the worker context
@param source common.VideoSource - the HLS source to tracker
@param dbConns db.ConnectionManager - DB connection manager
@param trackingWindow time.Duration - see note
@param segmentCache utils.VideoSegmentCache - HLS video segment cache
@param reader utils.SegmentReader - HLS video segment data reader
@param forwardSegment SegmentForwardCallback - callback to send out read video segments
@param metrics goutils.MetricsCollector - metrics framework client
@returns new SourceHLSMonitor

type SourceHLSTracker

type SourceHLSTracker interface {
	/*
		Update update status of the HLS source based on information in the current playlist.

		IMPORTANT: The playlist must be from the HLS source being tracked.

			@param ctxt context.Context - execution context
			@param currentPlaylist hls.Playlist - the current playlist for the video source
			@param timestamp time.Time - timestamp of when this update is called
			@returns the set of new segment described in the playlist
	*/
	Update(
		ctxt context.Context, currentPlaylist hls.Playlist, timestamp time.Time,
	) ([]common.VideoSegment, error)

	/*
		GetTrackedSegments fetch the list of tracked segments

			@param ctxt context.Context - execution context
			@returns tracked video segments
	*/
	GetTrackedSegments(ctxt context.Context) ([]common.VideoSegment, error)
}

SourceHLSTracker track status of a single HLS video source based on its playlist

func NewSourceHLSTracker

func NewSourceHLSTracker(
	source common.VideoSource, dbConns db.ConnectionManager, trackingWindow time.Duration,
) (SourceHLSTracker, error)

NewSourceHLSTracker define new single HLS source tracker

Tracking window is the duration in time a video segment is tracked. After observing a new segment, that segment is remembered for the duration of a tracking window, and forgotten after that.

@param source common.VideoSource - the HLS source to tracker
@param dbConns db.ConnectionManager - DB connection manager
@param trackingWindow time.Duration - see note
@returns new SourceHLSTracker

Jump to

Keyboard shortcuts

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