Documentation
¶
Overview ¶
Package server is the place we integrate the Livepeer node with the LPMS media server.
Index ¶
- Constants
- Variables
- func CalculateAudioToTextLatencyScore(took time.Duration, durationSeconds int64) float64
- func CalculateImageToImageLatencyScore(took time.Duration, req worker.GenImageToImageMultipartRequestBody, ...) float64
- func CalculateImageToTextLatencyScore(took time.Duration, outPixels int64) float64
- func CalculateImageToVideoLatencyScore(took time.Duration, req worker.GenImageToVideoMultipartRequestBody, ...) float64
- func CalculateLLMLatencyScore(took time.Duration, tokensUsed int) float64
- func CalculateSegmentAnything2LatencyScore(took time.Duration, outPixels int64) float64
- func CalculateTextToImageLatencyScore(took time.Duration, req worker.GenTextToImageJSONRequestBody, outPixels int64) float64
- func CalculateTextToSpeechLatencyScore(took time.Duration, inCharacters int64) float64
- func CalculateUpscaleLatencyScore(took time.Duration, req worker.GenUpscaleMultipartRequestBody, outPixels int64) float64
- func CheckOrchestratorAvailability(orch Orchestrator) bool
- func EndTranscodingSession(ctx context.Context, sess *BroadcastSession) error
- func GetOrchestratorInfo(ctx context.Context, bcast common.Broadcaster, orchestratorServer *url.URL, ...) (*net.OrchestratorInfo, error)
- func LiveErrorEventSender(ctx context.Context, streamID string, event map[string]string) func(err error)
- func NewOrchestratorSwapper(params aiRequestParams) *orchestratorSwapper
- func NewRemotePaymentSender(node *core.LivepeerNode) *remotePaymentSender
- func PixelFormatNone() ffmpeg.PixelFormat
- func RunAIWorker(n *core.LivepeerNode, orchAddr string, caps *net.Capabilities)
- func RunTranscoder(n *core.LivepeerNode, orchAddr string, capacity int, caps []core.Capability)
- func StartRemoteSignerServer(ls *LivepeerServer, bind string) error
- func StartTranscodeServer(orch Orchestrator, bind string, mux *http.ServeMux, workDir string, ...) error
- type AIAuthRequest
- type AIAuthResponse
- type AIJobRequestData
- type AISession
- type AISessionManager
- type AISessionPool
- func (pool *AISessionPool) Add(sessions []*BroadcastSession)
- func (pool *AISessionPool) Clear(newSessions []*BroadcastSession)
- func (pool *AISessionPool) Complete(sess *BroadcastSession)
- func (pool *AISessionPool) Remove(sess *BroadcastSession)
- func (pool *AISessionPool) Select(ctx context.Context) *BroadcastSession
- func (pool *AISessionPool) Size() int
- type AISessionSelector
- type APIError
- type APIErrorResponse
- type BadRequestError
- type Balance
- type BalanceUpdate
- type BalanceUpdateStatus
- type BlockGetter
- type BreakOperation
- type BroadcastConfig
- func (cfg *BroadcastConfig) GetCapabilitiesMaxPrice(caps common.CapabilityComparator) *big.Rat
- func (cfg *BroadcastConfig) MaxPrice() *big.Rat
- func (cfg *BroadcastConfig) SetCapabilityMaxPrice(cap core.Capability, modelID string, newPrice *core.AutoConvertedPrice)
- func (cfg *BroadcastConfig) SetMaxPrice(price *core.AutoConvertedPrice)
- type BroadcastSession
- type BroadcastSessionsManager
- type BroadcastSessionsSelector
- type BroadcastSessionsSelectorFactory
- type ChainIdGetter
- type GetOrchestratorInfoParams
- type HexBytes
- type ImageToVideoResponseAsync
- type ImageToVideoResult
- type ImageToVideoResultRequest
- type ImageToVideoResultResponse
- type ImageToVideoStatus
- type LIFOSelector
- func (s *LIFOSelector) Add(sessions []*BroadcastSession)
- func (s *LIFOSelector) Clear()
- func (s *LIFOSelector) Complete(sess *BroadcastSession)
- func (s *LIFOSelector) Remove(sess *BroadcastSession)
- func (s *LIFOSelector) Select(ctx context.Context) *BroadcastSession
- func (s *LIFOSelector) Size() int
- type LivePaymentProcessor
- type LivePaymentReceiver
- type LivePaymentSender
- type LiveSelectionAlgorithm
- type LivepeerServer
- func (ls *LivepeerServer) CreateWhep(server *media.WHEPServer) http.Handler
- func (ls *LivepeerServer) CreateWhip(server *media.WHIPServer) http.Handler
- func (ls *LivepeerServer) GenerateLivePayment(w http.ResponseWriter, r *http.Request)
- func (ls *LivepeerServer) GetLiveVideoToVideoStatus() http.Handler
- func (s *LivepeerServer) GetNodeStatus() *common.NodeStatus
- func (ls *LivepeerServer) GetOrchestrators(pool *remoteDiscoveryPool, w http.ResponseWriter, r *http.Request)
- func (s *LivepeerServer) HandlePush(w http.ResponseWriter, r *http.Request)
- func (s *LivepeerServer) HandleRecordings(w http.ResponseWriter, r *http.Request)
- func (ls *LivepeerServer) ImageToVideo() http.Handler
- func (ls *LivepeerServer) ImageToVideoResult() http.Handler
- func (ls *LivepeerServer) LLM() http.Handler
- func (s *LivepeerServer) LastHLSStreamID() core.StreamID
- func (s *LivepeerServer) LastManifestID() core.ManifestID
- func (s *LivepeerServer) LatestPlaylist() core.PlaylistManager
- func (s *LivepeerServer) SetContextFromUnitTest(c context.Context)
- func (ls *LivepeerServer) SignOrchestratorInfo(w http.ResponseWriter, r *http.Request)
- func (ls *LivepeerServer) SmokeTestLiveVideo() http.Handler
- func (s *LivepeerServer) StartCliWebserver(srv *http.Server)
- func (ls *LivepeerServer) StartLiveVideo() http.Handler
- func (s *LivepeerServer) StartMediaServer(ctx context.Context, httpAddr string) error
- func (ls *LivepeerServer) UpdateLiveVideo() http.Handler
- func (ls *LivepeerServer) WithCode(code int) http.Handler
- type MinLSSelector
- func (s *MinLSSelector) Add(sessions []*BroadcastSession)
- func (s *MinLSSelector) Clear()
- func (s *MinLSSelector) Complete(sess *BroadcastSession)
- func (s *MinLSSelector) Remove(sess *BroadcastSession)
- func (s *MinLSSelector) Select(ctx context.Context) *BroadcastSession
- func (s *MinLSSelector) Size() int
- type OrchInfoSigResponse
- type Orchestrator
- type ProbabilitySelectionAlgorithm
- type ReceivedTranscodeResult
- type Redeemer
- func (r *Redeemer) MaxFloat(ctx context.Context, req *net.MaxFloatReq) (*net.MaxFloatUpdate, error)
- func (r *Redeemer) MonitorMaxFloat(req *net.MaxFloatReq, stream net.TicketRedeemer_MonitorMaxFloatServer) error
- func (r *Redeemer) QueueTicket(ctx context.Context, ticket *net.Ticket) (*net.QueueTicketRes, error)
- func (r *Redeemer) Start(url *url.URL, workDir string) error
- func (r *Redeemer) Stop()
- type RedeemerClient
- type RemoteDiscoveryConfig
- type RemotePaymentRequest
- type RemotePaymentResponse
- type RemotePaymentState
- type RemotePaymentStateSig
- type Router
- func (r *Router) EndTranscodingSession(ctx context.Context, request *net.EndTranscodingSessionRequest) (*net.EndTranscodingSessionResponse, error)
- func (r *Router) GetOrchestrator(ctx context.Context, req *net.OrchestratorRequest) (*net.OrchestratorInfo, error)
- func (r *Router) Ping(ctx context.Context, req *net.PingPong) (*net.PingPong, error)
- func (r *Router) Start(uri *url.URL, serviceURI *url.URL, workDir string) error
- func (r *Router) Stop()
- type SegFlightMetadata
- type SegmentInfoReceiver
- type SegmentInfoSender
- type Selector
- type ServiceUnavailableError
- type SessionPool
- type SlowOrchChecker
- type StubCapabilityComparator
- type SubmitResult
Constants ¶
const ( // Staged indicates that the update has been created but the credit // has not been spent yet Staged = iota // CreditSpent indicates that the update's credit has been spent // but the debit has not been processed yet CreditSpent // ReceivedChange indicates that the update's credit has been spent // and a debit was processed such that there was "change" (net of credit/debit) ReceivedChange )
const AISessionManagerTTL = 10 * time.Minute
const BroadcastRetry = 15 * time.Second
const GRPCConnectTimeout = 3 * time.Second
const GRPCTimeout = 8 * time.Second
const HLSBufferCap = uint(43200) //12 hrs assuming 1s segment
const HLSBufferWindow = uint(5)
const HLSWaitInterval = time.Second
const HTTPIdleTimeout = 10 * time.Minute
const HTTPStatusNoTickets = 482
const HTTPStatusPriceExceeded = 481
const HTTPStatusRefreshSession = 480
const LIVERPEER_TRANSCODE_CONFIG_HEADER = "Livepeer-Transcode-Configuration"
const MainnetChainId = 1
const RemoteType_LiveVideoToVideo = "lv2v"
const RinkebyChainId = 4
const SELECTOR_LATENCY_SCORE_THRESHOLD = 1.0
const SegLen = 2 * time.Second
const StreamKeyBytes = 6
Variables ¶
var AuthWebhookURL *url.URL
var BroadcastCfg = NewBroadcastConfig()
var BroadcastJobVideoProfiles = []ffmpeg.VideoProfile{ffmpeg.P240p30fps4x3, ffmpeg.P360p30fps16x9}
var GatewayStatus = streamStatusStore{/* contains filtered or unexported fields */}
var MaxAIRequestSize = 3000000000 // 3GB
var MaxAttempts = 3
var MetadataPublishTimeout = 1 * time.Second
var MetadataQueue event.SimpleProducer
var NonRetryableErrMap = nonRetryableErrMapInit()
var Policy *verification.Policy
var StreamPrefix = regexp.MustCompile(`^[ /]*(stream/)?|(live/)?`) // test carefully!
StreamPrefix match all leading spaces, slashes and optionally `stream/`
var StreamStatusStore = streamStatusStore{/* contains filtered or unexported fields */}
var TrickleHTTPPath = "/ai/trickle/"
Functions ¶
func CalculateAudioToTextLatencyScore ¶ added in v0.8.0
CalculateAudioToTextLatencyScore computes the time taken per second of audio for an audio-to-text request.
func CalculateImageToImageLatencyScore ¶ added in v0.8.0
func CalculateImageToImageLatencyScore(took time.Duration, req worker.GenImageToImageMultipartRequestBody, outPixels int64) float64
CalculateImageToImageLatencyScore computes the time taken per pixel for an image-to-image request.
func CalculateImageToTextLatencyScore ¶ added in v0.8.0
func CalculateImageToVideoLatencyScore ¶ added in v0.8.0
func CalculateImageToVideoLatencyScore(took time.Duration, req worker.GenImageToVideoMultipartRequestBody, outPixels int64) float64
CalculateImageToVideoLatencyScore computes the time taken per pixel for an image-to-video request.
func CalculateLLMLatencyScore ¶ added in v0.8.0
func CalculateSegmentAnything2LatencyScore ¶ added in v0.8.0
CalculateSegmentAnything2LatencyScore computes the time taken per pixel for a segment-anything-2 request.
func CalculateTextToImageLatencyScore ¶ added in v0.8.0
func CalculateTextToImageLatencyScore(took time.Duration, req worker.GenTextToImageJSONRequestBody, outPixels int64) float64
CalculateTextToImageLatencyScore computes the time taken per pixel for an text-to-image request.
func CalculateTextToSpeechLatencyScore ¶ added in v0.8.0
CalculateTextToSpeechLatencyScore computes the time taken per character for a TextToSpeech request.
func CalculateUpscaleLatencyScore ¶ added in v0.8.0
func CalculateUpscaleLatencyScore(took time.Duration, req worker.GenUpscaleMultipartRequestBody, outPixels int64) float64
CalculateUpscaleLatencyScore computes the time taken per pixel for an upscale request.
func CheckOrchestratorAvailability ¶ added in v0.5.0
func CheckOrchestratorAvailability(orch Orchestrator) bool
CheckOrchestratorAvailability - the broadcaster calls CheckOrchestratorAvailability which invokes Ping on the orchestrator
func EndTranscodingSession ¶ added in v0.5.35
func EndTranscodingSession(ctx context.Context, sess *BroadcastSession) error
EndTranscodingSession - the broadcaster calls EndTranscodingSession to tear down sessions used for verification only once
func GetOrchestratorInfo ¶ added in v0.5.0
func GetOrchestratorInfo(ctx context.Context, bcast common.Broadcaster, orchestratorServer *url.URL, params GetOrchestratorInfoParams) (*net.OrchestratorInfo, error)
GetOrchestratorInfo - the broadcaster calls GetOrchestratorInfo which invokes GetOrchestrator on the orchestrator
func LiveErrorEventSender ¶ added in v0.8.2
func NewOrchestratorSwapper ¶ added in v0.8.6
func NewOrchestratorSwapper(params aiRequestParams) *orchestratorSwapper
func NewRemotePaymentSender ¶ added in v0.8.10
func NewRemotePaymentSender(node *core.LivepeerNode) *remotePaymentSender
func PixelFormatNone ¶ added in v0.5.30
func PixelFormatNone() ffmpeg.PixelFormat
func RunAIWorker ¶ added in v0.8.0
func RunAIWorker(n *core.LivepeerNode, orchAddr string, caps *net.Capabilities)
RunAIWorker is main routing of standalone aiworker Exiting it will terminate executable
func RunTranscoder ¶ added in v0.5.0
func RunTranscoder(n *core.LivepeerNode, orchAddr string, capacity int, caps []core.Capability)
RunTranscoder is main routing of standalone transcoder Exiting it will terminate executable
func StartRemoteSignerServer ¶ added in v0.8.10
func StartRemoteSignerServer(ls *LivepeerServer, bind string) error
StartRemoteSignerServer starts the HTTP server for remote signer mode
func StartTranscodeServer ¶ added in v0.3.3
func StartTranscodeServer(orch Orchestrator, bind string, mux *http.ServeMux, workDir string, acceptRemoteTranscoders bool, acceptRemoteAIWorkers bool, n *core.LivepeerNode) error
XXX do something about the implicit start of the http mux? this smells
Types ¶
type AIAuthRequest ¶ added in v0.8.1
type AIAuthRequest struct {
// Stream name or stream key
Stream string `json:"stream"`
StreamKey string `json:"stream_key"`
// Stream type, eg RTMP or WHIP
Type string `json:"type"`
// Query parameters that came with the stream, if any
QueryParams string `json:"query_params,omitempty"`
// Gateway host
GatewayHost string `json:"gateway_host"`
WhepURL string `json:"whep_url"`
StatusURL string `json:"status_url"`
UpdateURL string `json:"update_url"`
}
type AIAuthResponse ¶ added in v0.8.1
type AIAuthResponse struct {
// Where to send the output video
RTMPOutputURL string `json:"rtmp_output_url"`
// Name of the pipeline to run
Pipeline string `json:"pipeline"`
// ID of the pipeline to run
PipelineID string `json:"pipeline_id"`
// ID of the stream
StreamID string `json:"stream_id"`
// Parameters for the pipeline
PipelineParams json.RawMessage `json:"pipeline_parameters"`
// contains filtered or unexported fields
}
Contains the configuration parameters for this AI job
type AIJobRequestData ¶ added in v0.8.0
type AIJobRequestData struct {
InputUrl string `json:"input_url"`
Request json.RawMessage `json:"request"`
}
type AISession ¶ added in v0.8.0
type AISession struct {
*BroadcastSession
// Fields used by AISessionSelector for session lifecycle management
Cap core.Capability
ModelID string
Warm bool
}
type AISessionManager ¶ added in v0.8.0
type AISessionManager struct {
// contains filtered or unexported fields
}
func NewAISessionManager ¶ added in v0.8.0
func NewAISessionManager(node *core.LivepeerNode, ttl time.Duration) *AISessionManager
func (*AISessionManager) Complete ¶ added in v0.8.0
func (c *AISessionManager) Complete(ctx context.Context, sess *AISession) error
func (*AISessionManager) Remove ¶ added in v0.8.0
func (c *AISessionManager) Remove(ctx context.Context, sess *AISession) error
func (*AISessionManager) Select ¶ added in v0.8.0
func (c *AISessionManager) Select(ctx context.Context, cap core.Capability, modelID string) (*AISession, error)
type AISessionPool ¶ added in v0.8.0
type AISessionPool struct {
// contains filtered or unexported fields
}
func NewAISessionPool ¶ added in v0.8.0
func NewAISessionPool(selector BroadcastSessionsSelector, suspender *suspender, penalty int) *AISessionPool
func (*AISessionPool) Add ¶ added in v0.8.0
func (pool *AISessionPool) Add(sessions []*BroadcastSession)
func (*AISessionPool) Clear ¶ added in v0.8.5
func (pool *AISessionPool) Clear(newSessions []*BroadcastSession)
Clear clears the session that does not exist in newSessions
func (*AISessionPool) Complete ¶ added in v0.8.0
func (pool *AISessionPool) Complete(sess *BroadcastSession)
func (*AISessionPool) Remove ¶ added in v0.8.0
func (pool *AISessionPool) Remove(sess *BroadcastSession)
func (*AISessionPool) Select ¶ added in v0.8.0
func (pool *AISessionPool) Select(ctx context.Context) *BroadcastSession
func (*AISessionPool) Size ¶ added in v0.8.0
func (pool *AISessionPool) Size() int
type AISessionSelector ¶ added in v0.8.0
type AISessionSelector struct {
// contains filtered or unexported fields
}
func NewAISessionSelector ¶ added in v0.8.0
func NewAISessionSelector(ctx context.Context, cap core.Capability, modelID string, node *core.LivepeerNode, ttl time.Duration) (*AISessionSelector, error)
func (*AISessionSelector) Complete ¶ added in v0.8.0
func (sel *AISessionSelector) Complete(sess *AISession)
func (*AISessionSelector) Refresh ¶ added in v0.8.0
func (sel *AISessionSelector) Refresh(ctx context.Context) error
func (*AISessionSelector) Remove ¶ added in v0.8.0
func (sel *AISessionSelector) Remove(sess *AISession)
func (*AISessionSelector) Select ¶ added in v0.8.0
func (sel *AISessionSelector) Select(ctx context.Context) *AISession
func (*AISessionSelector) SelectorIsEmpty ¶ added in v0.8.4
func (sel *AISessionSelector) SelectorIsEmpty() bool
SelectorIsEmpty returns true if no orchestrators are in the warm or cold pools.
type APIErrorResponse ¶ added in v0.8.0
type APIErrorResponse struct {
Error error `json:"error"`
}
type BadRequestError ¶ added in v0.8.0
type BadRequestError struct {
// contains filtered or unexported fields
}
func (*BadRequestError) Error ¶ added in v0.8.0
func (e *BadRequestError) Error() string
type Balance ¶ added in v0.5.0
type Balance interface {
Credit(amount *big.Rat)
StageUpdate(minCredit *big.Rat, ev *big.Rat) (int, *big.Rat, *big.Rat)
Balance() *big.Rat
}
Balance describes methods for a session's balance maintenance
type BalanceUpdate ¶ added in v0.5.0
type BalanceUpdate struct {
// ExistingCredit is the existing credit reserved for the update
ExistingCredit *big.Rat
// NewCredit is the new credit for the update provided by a payment
NewCredit *big.Rat
// NumTickets is the number of tickets in the payment for the update
NumTickets int
// Debit is the amount to debit for the update
Debit *big.Rat
// Status is the current status of the update
Status BalanceUpdateStatus
}
BalanceUpdate describes an update to be performed on the balance of a session
type BalanceUpdateStatus ¶ added in v0.5.0
type BalanceUpdateStatus int
BalanceUpdateStatus indicates the current status of a balance update
type BlockGetter ¶ added in v0.5.0
type BreakOperation ¶ added in v0.5.30
type BreakOperation bool
type BroadcastConfig ¶ added in v0.5.0
type BroadcastConfig struct {
// contains filtered or unexported fields
}
func NewBroadcastConfig ¶ added in v0.8.9
func NewBroadcastConfig() *BroadcastConfig
func (*BroadcastConfig) GetCapabilitiesMaxPrice ¶ added in v0.8.0
func (cfg *BroadcastConfig) GetCapabilitiesMaxPrice(caps common.CapabilityComparator) *big.Rat
GetCapabilitiesMaxPrice returns the max price for the given capabilities.
func (*BroadcastConfig) MaxPrice ¶ added in v0.5.0
func (cfg *BroadcastConfig) MaxPrice() *big.Rat
func (*BroadcastConfig) SetCapabilityMaxPrice ¶ added in v0.8.0
func (cfg *BroadcastConfig) SetCapabilityMaxPrice(cap core.Capability, modelID string, newPrice *core.AutoConvertedPrice)
func (*BroadcastConfig) SetMaxPrice ¶ added in v0.5.0
func (cfg *BroadcastConfig) SetMaxPrice(price *core.AutoConvertedPrice)
type BroadcastSession ¶ added in v0.5.0
type BroadcastSession struct {
Broadcaster common.Broadcaster
Params *core.StreamParameters
BroadcasterOS drivers.OSSession
Sender pm.Sender
Balances *core.AddressBalances
OrchestratorScore float32
VerifiedByPerceptualHash bool
// access these fields under the lock
SegsInFlight []SegFlightMetadata
LatencyScore float64
OrchestratorInfo *net.OrchestratorInfo
OrchestratorOS drivers.OSSession
PMSessionID string
CleanupSession sessionsCleanup
Balance Balance
InitialPrice *net.PriceInfo
InitialLatency time.Duration
// contains filtered or unexported fields
}
BroadcastSession - session-specific state for broadcasters
func (*BroadcastSession) Address ¶ added in v0.5.23
func (bs *BroadcastSession) Address() string
func (*BroadcastSession) Clone ¶ added in v0.5.23
func (bs *BroadcastSession) Clone() *BroadcastSession
func (*BroadcastSession) IsTrusted ¶ added in v0.5.23
func (bs *BroadcastSession) IsTrusted() bool
func (*BroadcastSession) Transcoder ¶ added in v0.5.23
func (bs *BroadcastSession) Transcoder() string
type BroadcastSessionsManager ¶ added in v0.5.0
type BroadcastSessionsManager struct {
VerificationFreq uint
// contains filtered or unexported fields
}
func NewSessionManager ¶ added in v0.5.0
func NewSessionManager(ctx context.Context, node *core.LivepeerNode, params *core.StreamParameters) *BroadcastSessionsManager
type BroadcastSessionsSelector ¶ added in v0.5.2
type BroadcastSessionsSelector interface {
Add(sessions []*BroadcastSession)
Remove(sess *BroadcastSession)
Complete(sess *BroadcastSession)
Select(ctx context.Context) *BroadcastSession
Size() int
Clear()
}
BroadcastSessionsSelector selects the next BroadcastSession to use
type BroadcastSessionsSelectorFactory ¶ added in v0.5.23
type BroadcastSessionsSelectorFactory func() BroadcastSessionsSelector
type ChainIdGetter ¶ added in v0.5.30
type GetOrchestratorInfoParams ¶ added in v0.8.5
type GetOrchestratorInfoParams struct {
Caps *net.Capabilities
IgnoreCapacityCheck bool
}
type HexBytes ¶ added in v0.8.10
type HexBytes []byte
HexBytes represents a byte slice that marshals/unmarshals as hex with 0x prefix
func (HexBytes) MarshalJSON ¶ added in v0.8.10
func (*HexBytes) UnmarshalJSON ¶ added in v0.8.10
type ImageToVideoResponseAsync ¶ added in v0.8.0
type ImageToVideoResponseAsync struct {
RequestID string `json:"request_id"`
}
type ImageToVideoResult ¶ added in v0.8.0
type ImageToVideoResult struct {
*worker.ImageResponse
Error *APIError `json:"error,omitempty"`
}
type ImageToVideoResultRequest ¶ added in v0.8.0
type ImageToVideoResultRequest struct {
RequestID string `json:"request_id"`
}
type ImageToVideoResultResponse ¶ added in v0.8.0
type ImageToVideoResultResponse struct {
Result *ImageToVideoResult `json:"result,omitempty"`
Status ImageToVideoStatus `json:"status"`
}
type ImageToVideoStatus ¶ added in v0.8.0
type ImageToVideoStatus string
const ( Processing ImageToVideoStatus = "processing" Complete ImageToVideoStatus = "complete" )
type LIFOSelector ¶ added in v0.5.2
type LIFOSelector []*BroadcastSession
LIFOSelector selects the next BroadcastSession in LIFO order now used only in tests
func (*LIFOSelector) Add ¶ added in v0.5.2
func (s *LIFOSelector) Add(sessions []*BroadcastSession)
Add adds the sessions to the front of the selector's list
func (*LIFOSelector) Clear ¶ added in v0.5.2
func (s *LIFOSelector) Clear()
Clear resets the selector's state
func (*LIFOSelector) Complete ¶ added in v0.5.2
func (s *LIFOSelector) Complete(sess *BroadcastSession)
Complete adds the session to the end of the selector's list
func (*LIFOSelector) Remove ¶ added in v0.8.5
func (s *LIFOSelector) Remove(sess *BroadcastSession)
Remove removes the session from the selector's list
func (*LIFOSelector) Select ¶ added in v0.5.2
func (s *LIFOSelector) Select(ctx context.Context) *BroadcastSession
Select returns the last session in the selector's list
func (*LIFOSelector) Size ¶ added in v0.5.2
func (s *LIFOSelector) Size() int
Size returns the number of sessions stored by the selector
type LivePaymentProcessor ¶ added in v0.8.2
type LivePaymentProcessor struct {
// contains filtered or unexported fields
}
func NewLivePaymentProcessor ¶ added in v0.8.2
type LivePaymentReceiver ¶ added in v0.8.0
type LivePaymentReceiver interface {
// AccountSegment checks if the stream is paid and if not it returns error, so that stream can be stopped
AccountSegment(ctx context.Context, segmentInfo *SegmentInfoReceiver) error
}
LivePaymentReceiver is used in Orchestrator to account for each processed segment
type LivePaymentSender ¶ added in v0.8.0
type LivePaymentSender interface {
// SendPayment process the streamInfo and sends a payment to Orchestrator if needed
SendPayment(ctx context.Context, segmentInfo *SegmentInfoSender) error
}
LivePaymentSender is used in Gateway to send payment to Orchestrator
type LiveSelectionAlgorithm ¶ added in v0.8.7
type LiveSelectionAlgorithm struct{}
LiveSelectionAlgorithm is the Selection Algorithm used for Realtime Video AI
type LivepeerServer ¶
type LivepeerServer struct {
RTMPSegmenter lpmscore.RTMPSegmenter
LPMS *lpmscore.LPMS
LivepeerNode *core.LivepeerNode
HTTPMux *http.ServeMux
ExposeCurrentManifest bool
AISessionManager *AISessionManager
// contains filtered or unexported fields
}
func NewLivepeerServer ¶
func NewLivepeerServer(ctx context.Context, rtmpAddr string, lpNode *core.LivepeerNode, httpIngest bool, transcodingOptions string) (*LivepeerServer, error)
func (*LivepeerServer) CreateWhep ¶ added in v0.8.9
func (ls *LivepeerServer) CreateWhep(server *media.WHEPServer) http.Handler
func (*LivepeerServer) CreateWhip ¶ added in v0.8.4
func (ls *LivepeerServer) CreateWhip(server *media.WHIPServer) http.Handler
func (*LivepeerServer) GenerateLivePayment ¶ added in v0.8.10
func (ls *LivepeerServer) GenerateLivePayment(w http.ResponseWriter, r *http.Request)
GenerateLivePayment handles remote generation of a payment for live streams.
func (*LivepeerServer) GetLiveVideoToVideoStatus ¶ added in v0.8.2
func (ls *LivepeerServer) GetLiveVideoToVideoStatus() http.Handler
@Summary Get Live Stream Status @Param stream path string true "Stream ID" @Success 200 @Router /live/video-to-video/{stream}/status [get]
func (*LivepeerServer) GetNodeStatus ¶ added in v0.5.0
func (s *LivepeerServer) GetNodeStatus() *common.NodeStatus
func (*LivepeerServer) GetOrchestrators ¶ added in v0.8.10
func (ls *LivepeerServer) GetOrchestrators(pool *remoteDiscoveryPool, w http.ResponseWriter, r *http.Request)
GetOrchestrators returns the configured orchestrators in webhook-compatible format
func (*LivepeerServer) HandlePush ¶ added in v0.5.0
func (s *LivepeerServer) HandlePush(w http.ResponseWriter, r *http.Request)
HandlePush processes request for HTTP ingest
func (*LivepeerServer) HandleRecordings ¶ added in v0.5.13
func (s *LivepeerServer) HandleRecordings(w http.ResponseWriter, r *http.Request)
HandleRecordings handle requests to /recordings/ endpoint
func (*LivepeerServer) ImageToVideo ¶ added in v0.8.0
func (ls *LivepeerServer) ImageToVideo() http.Handler
func (*LivepeerServer) ImageToVideoResult ¶ added in v0.8.0
func (ls *LivepeerServer) ImageToVideoResult() http.Handler
func (*LivepeerServer) LLM ¶ added in v0.8.0
func (ls *LivepeerServer) LLM() http.Handler
func (*LivepeerServer) LastHLSStreamID ¶ added in v0.5.0
func (s *LivepeerServer) LastHLSStreamID() core.StreamID
func (*LivepeerServer) LastManifestID ¶ added in v0.5.0
func (s *LivepeerServer) LastManifestID() core.ManifestID
func (*LivepeerServer) LatestPlaylist ¶ added in v0.5.0
func (s *LivepeerServer) LatestPlaylist() core.PlaylistManager
Debug helpers
func (*LivepeerServer) SetContextFromUnitTest ¶ added in v0.5.30
func (s *LivepeerServer) SetContextFromUnitTest(c context.Context)
func (*LivepeerServer) SignOrchestratorInfo ¶ added in v0.8.10
func (ls *LivepeerServer) SignOrchestratorInfo(w http.ResponseWriter, r *http.Request)
SignOrchestratorInfo handles signing GetOrchestratorInfo requests for multiple orchestrators
func (*LivepeerServer) SmokeTestLiveVideo ¶ added in v0.8.3
func (ls *LivepeerServer) SmokeTestLiveVideo() http.Handler
@Summary Start Smoke Test @Param request body smokeTestRequest true "smoke test request" @Success 200 @Router /live/video-to-video/smoketest [put]
func (*LivepeerServer) StartCliWebserver ¶ added in v0.5.0
func (s *LivepeerServer) StartCliWebserver(srv *http.Server)
StartCliWebserver starts web server for CLI blocks until exit
func (*LivepeerServer) StartLiveVideo ¶ added in v0.8.0
func (ls *LivepeerServer) StartLiveVideo() http.Handler
@Summary Start Live Video @Accept multipart/form-data @Param stream path string true "Stream Key" @Param source_id formData string true "MediaMTX source ID, used for calls back to MediaMTX" @Param source_type formData string true "MediaMTX specific source type (webrtcSession/rtmpConn)" @Param query formData string true "Queryparams from the original ingest URL" @Success 200 @Router /live/video-to-video/{stream}/start [get]
func (*LivepeerServer) StartMediaServer ¶
func (s *LivepeerServer) StartMediaServer(ctx context.Context, httpAddr string) error
StartMediaServer starts the LPMS server
func (*LivepeerServer) UpdateLiveVideo ¶ added in v0.8.1
func (ls *LivepeerServer) UpdateLiveVideo() http.Handler
@Summary Update Live Stream @Param stream path string true "Stream Key" @Param params body string true "update request" @Success 200 @Router /live/video-to-video/{stream}/update [post]
type MinLSSelector ¶ added in v0.5.2
type MinLSSelector struct {
Selector
// contains filtered or unexported fields
}
MinLSSelector selects the next BroadcastSession with the lowest latency score if it is good enough. Otherwise, it selects a session that does not have a latency score yet MinLSSelector is not concurrency safe so the caller is responsible for ensuring safety for concurrent method calls
func NewMinLSSelector ¶ added in v0.5.2
func NewMinLSSelector(stakeRdr stakeReader, minLS float64, selectionAlgorithm common.SelectionAlgorithm, perfScore *common.PerfScore, capabilities common.CapabilityComparator) *MinLSSelector
NewMinLSSelector returns an instance of MinLSSelector configured with a good enough latency score
func (*MinLSSelector) Add ¶ added in v0.5.2
func (s *MinLSSelector) Add(sessions []*BroadcastSession)
Add adds the sessions to the selector's list of sessions without a latency score
func (*MinLSSelector) Clear ¶ added in v0.5.2
func (s *MinLSSelector) Clear()
Clear resets the selector's state
func (*MinLSSelector) Complete ¶ added in v0.5.2
func (s *MinLSSelector) Complete(sess *BroadcastSession)
Complete adds the session to the selector's list sessions with a latency score
func (*MinLSSelector) Remove ¶ added in v0.8.5
func (s *MinLSSelector) Remove(sess *BroadcastSession)
Remove removes the session from the selector's list of sessions without a latency score
func (*MinLSSelector) Select ¶ added in v0.5.2
func (s *MinLSSelector) Select(ctx context.Context) *BroadcastSession
Select returns the session with the lowest latency score if it is good enough. Otherwise, a session without a latency score yet is returned
func (*MinLSSelector) Size ¶ added in v0.5.2
func (s *MinLSSelector) Size() int
Size returns the number of sessions stored by the selector
type OrchInfoSigResponse ¶ added in v0.8.10
type OrchInfoSigResponse struct {
Address HexBytes `json:"address"`
Signature HexBytes `json:"signature"`
}
OrchInfoSigResponse represents the response from the remote signer
func GetOrchInfoSig ¶ added in v0.8.10
func GetOrchInfoSig(remoteSignerHost *url.URL) (*OrchInfoSigResponse, error)
Gateway helper that calls the remote signer service for the GetOrchestratorInfo signature
type Orchestrator ¶ added in v0.3.3
type Orchestrator interface {
ServiceURI() *url.URL
Address() ethcommon.Address
TranscoderSecret() string
Sign([]byte) ([]byte, error)
VerifySig(ethcommon.Address, string, []byte) bool
CheckCapacity(core.ManifestID) error
CheckAICapacity(pipeline, modelID string) (bool, chan<- bool)
GetLiveAICapacity(pipeline, modelID string) worker.Capacity
TranscodeSeg(context.Context, *core.SegTranscodingMetadata, *stream.HLSSegment) (*core.TranscodeResult, error)
ServeTranscoder(stream net.Transcoder_RegisterTranscoderServer, capacity int, capabilities *net.Capabilities)
TranscoderResults(job int64, res *core.RemoteTranscoderResult)
ServeAIWorker(stream net.AIWorker_RegisterAIWorkerServer, capabilities *net.Capabilities, hardware []*net.HardwareInformation)
AIResults(job int64, res *core.RemoteAIWorkerResult)
ProcessPayment(ctx context.Context, payment net.Payment, manifestID core.ManifestID) error
TicketParams(sender ethcommon.Address, priceInfo *net.PriceInfo) (*net.TicketParams, error)
PriceInfo(sender ethcommon.Address, manifestID core.ManifestID) (*net.PriceInfo, error)
PriceInfoForCaps(sender ethcommon.Address, manifestID core.ManifestID, caps *net.Capabilities) (*net.PriceInfo, error)
GetCapabilitiesPrices(sender ethcommon.Address) ([]*net.PriceInfo, error)
SufficientBalance(addr ethcommon.Address, manifestID core.ManifestID) bool
DebitFees(addr ethcommon.Address, manifestID core.ManifestID, price *net.PriceInfo, pixels int64)
Balance(addr ethcommon.Address, manifestID core.ManifestID) *big.Rat
Capabilities() *net.Capabilities
AuthToken(sessionID string, expiration int64) *net.AuthToken
CreateStorageForRequest(requestID string) error
GetStorageForRequest(requestID string) (drivers.OSSession, bool)
WorkerHardware() []worker.HardwareInformation
Nodes() []string
TextToImage(ctx context.Context, requestID string, req worker.GenTextToImageJSONRequestBody) (interface{}, error)
ImageToImage(ctx context.Context, requestID string, req worker.GenImageToImageMultipartRequestBody) (interface{}, error)
ImageToVideo(ctx context.Context, requestID string, req worker.GenImageToVideoMultipartRequestBody) (interface{}, error)
Upscale(ctx context.Context, requestID string, req worker.GenUpscaleMultipartRequestBody) (interface{}, error)
AudioToText(ctx context.Context, requestID string, req worker.GenAudioToTextMultipartRequestBody) (interface{}, error)
LLM(ctx context.Context, requestID string, req worker.GenLLMJSONRequestBody) (interface{}, error)
SegmentAnything2(ctx context.Context, requestID string, req worker.GenSegmentAnything2MultipartRequestBody) (interface{}, error)
ImageToText(ctx context.Context, requestID string, req worker.GenImageToTextMultipartRequestBody) (interface{}, error)
TextToSpeech(ctx context.Context, requestID string, req worker.GenTextToSpeechJSONRequestBody) (interface{}, error)
LiveVideoToVideo(ctx context.Context, requestID string, req worker.GenLiveVideoToVideoJSONRequestBody) (interface{}, error)
RegisterExternalCapability(extCapability string) (*core.ExternalCapability, error)
RemoveExternalCapability(extCapability string) error
GetUrlForCapability(extCapability string) string
CheckExternalCapabilityCapacity(extCapability string) int64
ReserveExternalCapabilityCapacity(extCapability string) error
FreeExternalCapabilityCapacity(extCapability string) error
JobPriceInfo(sender ethcommon.Address, jobCapabiliy string) (*net.PriceInfo, error)
}
type ProbabilitySelectionAlgorithm ¶ added in v0.7.0
type ProbabilitySelectionAlgorithm struct {
MinPerfScore float64
StakeWeight float64
PriceWeight float64
RandWeight float64
PriceExpFactor float64
IgnoreMaxPriceIfNeeded bool
}
type ReceivedTranscodeResult ¶ added in v0.5.2
type ReceivedTranscodeResult struct {
*net.TranscodeData
Info *net.OrchestratorInfo
LatencyScore float64
}
ReceivedTranscodeResult contains received transcode result data and related metadata
func SubmitSegment ¶ added in v0.3.3
func SubmitSegment(ctx context.Context, sess *BroadcastSession, seg *stream.HLSSegment, segPar *core.SegmentParameters, nonce uint64, calcPerceptualHash, verified bool) (*ReceivedTranscodeResult, error)
type Redeemer ¶ added in v0.5.9
type Redeemer struct {
net.UnimplementedTicketRedeemerServer
// contains filtered or unexported fields
}
func NewRedeemer ¶ added in v0.5.9
func NewRedeemer(recipient ethcommon.Address, eth eth.LivepeerEthClient, sm *pm.LocalSenderMonitor) (*Redeemer, error)
NewRedeemer creates a new ticket redemption service instance
func (*Redeemer) MaxFloat ¶ added in v0.5.9
func (r *Redeemer) MaxFloat(ctx context.Context, req *net.MaxFloatReq) (*net.MaxFloatUpdate, error)
MaxFloat is a unary RPC method to request the max float value for a sender
func (*Redeemer) MonitorMaxFloat ¶ added in v0.5.9
func (r *Redeemer) MonitorMaxFloat(req *net.MaxFloatReq, stream net.TicketRedeemer_MonitorMaxFloatServer) error
MonitorMaxFloat starts a server-side stream to the client to send max float updates for sender specified in the request
func (*Redeemer) QueueTicket ¶ added in v0.5.9
func (r *Redeemer) QueueTicket(ctx context.Context, ticket *net.Ticket) (*net.QueueTicketRes, error)
QueueTicket adds a ticket to the ticket queue
type RedeemerClient ¶ added in v0.5.9
type RedeemerClient struct {
// contains filtered or unexported fields
}
func NewRedeemerClient ¶ added in v0.5.9
func NewRedeemerClient(uri string, sm pm.SenderManager, tm pm.TimeManager) (*RedeemerClient, error)
NewRedeemerClient instantiates a new client for the ticket redemption service The client implements the pm.SenderMonitor interface
func (*RedeemerClient) MaxFloat ¶ added in v0.5.9
MaxFloat returns the max float for 'sender' If no local cache is available this method will remotely request max float from the Redeemer server and start watching for subsequent updates from the Redeemer server
func (*RedeemerClient) QueueTicket ¶ added in v0.5.9
func (r *RedeemerClient) QueueTicket(ticket *pm.SignedTicket) error
QueueTicket sends a winning ticket to the Redeemer
func (*RedeemerClient) Start ¶ added in v0.5.9
func (r *RedeemerClient) Start()
func (*RedeemerClient) Stop ¶ added in v0.5.9
func (r *RedeemerClient) Stop()
Stop stops the Redeemer client
func (*RedeemerClient) ValidateSender ¶ added in v0.5.9
func (r *RedeemerClient) ValidateSender(sender ethcommon.Address) error
ValidateSender checks whether a sender has not recently unlocked its deposit and reserve
type RemoteDiscoveryConfig ¶ added in v0.8.10
type RemoteDiscoveryConfig struct {
Pool common.OrchestratorPool
Node *core.LivepeerNode
Interval time.Duration
}
func (RemoteDiscoveryConfig) New ¶ added in v0.8.10
func (cfg RemoteDiscoveryConfig) New() *remoteDiscoveryPool
type RemotePaymentRequest ¶ added in v0.8.10
type RemotePaymentRequest struct {
// State is an opaque, signed blob previously returned by the remote signer.
State RemotePaymentStateSig `json:"state,omitempty"`
// protobuf bytes of net.OrchestratorInfo. Required
Orchestrator []byte `json:"orchestrator"`
// Set if an ID is needed to tie into orch accounting for a session. Optional
ManifestID string
// Number of pixels to generate a ticket for. Required if `type` is not set.
InPixels int64 `json:"inPixels"`
// Job type to automatically calculate payments. Valid values: `lv2v`. Optional.
Type string `json:"type"`
// Capabilities to include in the ticket. Optional; may be set for the lv2v job type.
Capabilities []byte `json:"capabilities"`
}
RemotePaymentRequest is sent by the gateway to the remote signer to request a batch of tickets. TODO length limits for string / byte fields
type RemotePaymentResponse ¶ added in v0.8.10
type RemotePaymentResponse struct {
Payment string `json:"payment"`
SegCreds string `json:"segCreds,omitempty"`
State RemotePaymentStateSig `json:"state"`
}
Returned by the remote signer and includes a new payment plus updated state.
type RemotePaymentState ¶ added in v0.8.10
type RemotePaymentState struct {
StateID string
PMSessionID string
LastUpdate time.Time
OrchestratorAddress ethcommon.Address
SenderNonce uint32
Balance string
InitialPricePerUnit int64
InitialPixelsPerUnit int64
}
State required for remote ticket creation. Treated as an opaque, signed blob by the gateway.
type RemotePaymentStateSig ¶ added in v0.8.10
type Router ¶ added in v0.5.15
type Router struct {
net.UnimplementedOrchestratorServer
// contains filtered or unexported fields
}
func (*Router) EndTranscodingSession ¶ added in v0.5.35
func (r *Router) EndTranscodingSession(ctx context.Context, request *net.EndTranscodingSessionRequest) (*net.EndTranscodingSessionResponse, error)
func (*Router) GetOrchestrator ¶ added in v0.5.15
func (r *Router) GetOrchestrator(ctx context.Context, req *net.OrchestratorRequest) (*net.OrchestratorInfo, error)
type SegFlightMetadata ¶ added in v0.5.14
type SegFlightMetadata struct {
// contains filtered or unexported fields
}
type SegmentInfoReceiver ¶ added in v0.8.0
type SegmentInfoReceiver struct {
// contains filtered or unexported fields
}
type SegmentInfoSender ¶ added in v0.8.0
type SegmentInfoSender struct {
// contains filtered or unexported fields
}
type Selector ¶ added in v0.8.4
type Selector struct {
// contains filtered or unexported fields
}
Selector is the default selector which always selects the session with the lowest initial latency.
func NewSelector ¶ added in v0.8.4
func NewSelector(stakeRdr stakeReader, selectionAlgorithm common.SelectionAlgorithm, perfScore *common.PerfScore, capabilities common.CapabilityComparator) *Selector
func NewSelectorOrderByLatencyScore ¶ added in v0.8.4
func NewSelectorOrderByLatencyScore(stakeRdr stakeReader, selectionAlgorithm common.SelectionAlgorithm, perfScore *common.PerfScore, capabilities common.CapabilityComparator) *Selector
func (*Selector) Add ¶ added in v0.8.4
func (s *Selector) Add(sessions []*BroadcastSession)
func (*Selector) Complete ¶ added in v0.8.4
func (s *Selector) Complete(sess *BroadcastSession)
func (*Selector) Remove ¶ added in v0.8.5
func (s *Selector) Remove(sess *BroadcastSession)
type ServiceUnavailableError ¶ added in v0.8.0
type ServiceUnavailableError struct {
// contains filtered or unexported fields
}
func (*ServiceUnavailableError) Error ¶ added in v0.8.0
func (e *ServiceUnavailableError) Error() string
type SessionPool ¶ added in v0.5.23
type SessionPool struct {
// contains filtered or unexported fields
}
func NewSessionPool ¶ added in v0.5.23
func NewSessionPool(mid core.ManifestID, poolSize, numOrchs int, sus *suspender, createSession sessionsCreator, cleanupSession sessionsCleanup, sel BroadcastSessionsSelector) *SessionPool
type SlowOrchChecker ¶ added in v0.8.2
type SlowOrchChecker struct {
// contains filtered or unexported fields
}
Detect 'slow' orchs by keeping track of in-flight segments Count the difference between segments produced and segments completed
func (*SlowOrchChecker) BeginSegment ¶ added in v0.8.2
func (s *SlowOrchChecker) BeginSegment() (int, bool)
Returns the number of segments begun so far and whether the max number of inflight segments was hit. Number of segments is not incremented if inflight max is hit. If inflight max is hit, returns true, false otherwise.
func (*SlowOrchChecker) EndSegment ¶ added in v0.8.2
func (s *SlowOrchChecker) EndSegment()
func (*SlowOrchChecker) GetCount ¶ added in v0.8.2
func (s *SlowOrchChecker) GetCount() int
type StubCapabilityComparator ¶ added in v0.8.0
type StubCapabilityComparator struct {
NetCaps *net.Capabilities
IsLegacy bool
}
func (*StubCapabilityComparator) CompatibleWith ¶ added in v0.8.0
func (s *StubCapabilityComparator) CompatibleWith(other *net.Capabilities) bool
func (*StubCapabilityComparator) LegacyOnly ¶ added in v0.8.0
func (s *StubCapabilityComparator) LegacyOnly() bool
func (*StubCapabilityComparator) ToNetCapabilities ¶ added in v0.8.0
func (s *StubCapabilityComparator) ToNetCapabilities() *net.Capabilities
type SubmitResult ¶ added in v0.5.23
type SubmitResult struct {
Session *BroadcastSession
TranscodeResult *ReceivedTranscodeResult
Err error
}
Source Files
¶
- ai_http.go
- ai_live_video.go
- ai_mediaserver.go
- ai_pipeline_status.go
- ai_process.go
- ai_session.go
- ai_worker.go
- auth.go
- broadcast.go
- cert.go
- handlers.go
- live_payment.go
- live_payment_processor.go
- mediaserver.go
- ot_rpc.go
- redeemer.go
- remote_discovery.go
- remote_signer.go
- router.go
- rpc.go
- segment_rpc.go
- selection.go
- selection_algorithm.go
- stub.go
- suspensions.go
- utils.go
- webserver.go