Documentation
¶
Index ¶
- Variables
- type CamService
- type CutRequest
- type LiveStateNotifier
- type Manager
- func (m *Manager) EndStream(ctx context.Context, streamID uint, discardVoD bool) error
- func (m *Manager) Notify(ctx context.Context, notification *protobuf.Notification) (resp *protobuf.NotificationResponse, err error)
- func (m *Manager) ReapStaleStreams()
- func (m *Manager) Register(ctx context.Context, req *protobuf.RegisterRequest) (*protobuf.RegisterResponse, error)
- func (m *Manager) RequestCut(ctx context.Context, req CutRequest) (err error)
- func (m *Manager) RequestLivePreview(ctx context.Context, playlistURL string) ([]byte, error)
- func (m *Manager) RequestRedoPostProcessing(ctx context.Context, req RedoPostProcessingRequest) (err error)
- func (m *Manager) RequestSectionImages(ctx context.Context, req SectionImageRequest) (err error)
- func (m *Manager) RequestSelfStream(ctx context.Context, stream model.Stream) (err error)
- func (m *Manager) RequestSilenceScan(ctx context.Context, streamID uint) error
- func (m *Manager) RequestUpload(ctx context.Context, streamID uint, version model.StreamVersion) (slot UploadSlot, err error)
- func (m *Manager) RequestWaveform(ctx context.Context, streamID uint, sources []VersionSource) (err error)
- func (m *Manager) Run() error
- func (m *Manager) TriggerDueStreams() error
- func (m *Manager) UpdateLights()
- type Option
- type RedoPostProcessingRequest
- type SectionImageRequest
- type UploadSlot
- type VersionSource
Constants ¶
This section is empty.
Variables ¶
var ErrNoRunner = errors.New("no runner is available")
ErrNoRunner is returned when no runner is alive and accepting jobs.
Functions ¶
This section is empty.
Types ¶
type CamService ¶ added in v1.7.0
type CutRequest ¶ added in v1.16.0
type CutRequest struct {
SourceStreamID uint
TargetStreamID uint
Version model.StreamVersion
PlaylistURL string
Discard []model.CutRange
}
CutRequest describes the cut of one version of a VOD. TargetStreamID is SourceStreamID to replace the VOD, and another lecture to give it the result. PlaylistURL must be signed.
type LiveStateNotifier ¶ added in v1.7.9
LiveStateNotifier is called whenever a stream transitions into or out of the live state, so that other parts of the application (e.g. the websocket hub) can react to it.
type Manager ¶
type Manager struct {
protobuf.UnimplementedRunnerManagerServiceServer
// contains filtered or unexported fields
}
Manager manages communication with runners and handles job distribution
func New ¶
func New(dao dao.DaoWrapper, opts ...Option) *Manager
New returns a new instance of Manager with the given Options
func (*Manager) EndStream ¶ added in v1.7.9
EndStream cancels all runner jobs tracked for the given stream, e.g. when an admin manually stops a stream. It is a no-op if no runner jobs are tracked for the stream (e.g. because it has already ended).
func (*Manager) Notify ¶
func (m *Manager) Notify(ctx context.Context, notification *protobuf.Notification) (resp *protobuf.NotificationResponse, err error)
func (*Manager) ReapStaleStreams ¶ added in v1.7.9
func (m *Manager) ReapStaleStreams()
ReapStaleStreams finds streams that are stuck in live state and cleans them up. This handles the case where the runner crashes and can never deliver StreamEndNotification.
func (*Manager) Register ¶
func (m *Manager) Register(ctx context.Context, req *protobuf.RegisterRequest) (*protobuf.RegisterResponse, error)
func (*Manager) RequestCut ¶ added in v1.16.0
func (m *Manager) RequestCut(ctx context.Context, req CutRequest) (err error)
RequestCut asks a runner to cut one version of a VOD. It reports like an upload: progress, then VODReady, or VODFailed.
func (*Manager) RequestLivePreview ¶ added in v1.11.3
RequestLivePreview asks a runner for a JPEG of the most recent state of a livestream. playlistURL must be signed. Unlike the other thumbnail requests this one is synchronous, since a preview is replaced a minute later anyway.
func (*Manager) RequestRedoPostProcessing ¶ added in v1.12.0
func (m *Manager) RequestRedoPostProcessing(ctx context.Context, req RedoPostProcessingRequest) (err error)
RequestRedoPostProcessing asks a runner to redo the post-processing of an already-recorded VOD. The runner answers asynchronously in notifications, so this returns as soon as the job is accepted. The runner's RPC still has the name it was introduced with.
func (*Manager) RequestSectionImages ¶ added in v1.8.0
func (m *Manager) RequestSectionImages(ctx context.Context, req SectionImageRequest) (err error)
RequestSectionImages asks a runner to generate thumbnails for the given video sections. The runner answers asynchronously with a SectionImagesReadyNotification, which saveSectionImages then stores, so this returns as soon as the job is accepted.
func (*Manager) RequestSelfStream ¶ added in v1.5.7
func (*Manager) RequestSilenceScan ¶ added in v1.16.0
RequestSilenceScan has a runner scan the best version of the stream for silences.
func (*Manager) RequestUpload ¶ added in v1.11.0
func (m *Manager) RequestUpload(ctx context.Context, streamID uint, version model.StreamVersion) (slot UploadSlot, err error)
RequestUpload reserves a runner for an upload of one version of a stream's VOD. The caller sends the file to the returned slot; the runner then converts it and reports the result in a VODReadyNotification and a ThumbnailReadyNotification, which the manager stores like those of a recorded stream.
func (*Manager) RequestWaveform ¶ added in v1.16.0
func (m *Manager) RequestWaveform(ctx context.Context, streamID uint, sources []VersionSource) (err error)
RequestWaveform asks a runner for the audio level timeline of a stream and the length of the given versions. The answer is a WaveformReadyNotification, which saveWaveform stores.
func (*Manager) TriggerDueStreams ¶
func (*Manager) UpdateLights ¶ added in v1.7.5
func (m *Manager) UpdateLights()
type Option ¶
type Option func(m *Manager)
Option is a func that applies configuration to the Manager
func WithCamService ¶ added in v1.7.0
func WithCamService(camService CamService) Option
func WithListenAddr ¶
WithListenAddr sets the address the Manager listens on for gRPC connections from the Runner. If not applied, the default is used (:50056)
func WithLiveStateNotifier ¶ added in v1.7.9
func WithLiveStateNotifier(notifier LiveStateNotifier) Option
WithLiveStateNotifier registers a callback invoked when a stream starts or stops being live, e.g. to notify viewers via websocket.
func WithMassStorage ¶ added in v1.5.7
func WithSubtitleClient ¶ added in v1.5.7
func WithSubtitleClient(client pb.SubtitleGeneratorClient, auth string) Option
type RedoPostProcessingRequest ¶ added in v1.12.0
type RedoPostProcessingRequest struct {
StreamID uint
Version model.StreamVersion
PlaylistURL string
// DetectSilence also has the runner scan the VOD for silences.
DetectSilence bool
}
RedoPostProcessingRequest describes the VOD whose post-processing, its thumbnail and duration, its sprite if it has none, and optionally its silences, should be redone. PlaylistURL must be signed, as for SectionImageRequest.
type SectionImageRequest ¶ added in v1.8.0
type SectionImageRequest struct {
StreamID uint
PlaylistURL string
Sections []model.VideoSection
}
SectionImageRequest describes the video sections of a stream that need a thumbnail.
type UploadSlot ¶ added in v1.11.0
type UploadSlot struct {
// Host and Port are the runner's HTTP upload endpoint.
Host string
Port int
// Token is single use and only valid for a short time.
Token string
}
UploadSlot is where and how one video file can be sent to a runner.
type VersionSource ¶ added in v1.16.0
type VersionSource struct {
Version model.StreamVersion
PlaylistURL string
}
VersionSource is one version of a VOD and the signed playlist the runner reads it from.