Documentation ¶
Overview ¶
Core contains the main functionality of the Livepeer node.
The logical orgnization of the `core` module is as follows:
livepeernode.go: Main struct definition and code that is common to all node types. broadcaster.go: Code that is called only when the node is in broadcaster mode. orchestrator.go: Code that is called only when the node is in orchestrator mode.
Index ¶
- Constants
- Variables
- func NewBroadcaster(node *LivepeerNode, job *ethTypes.Job) *broadcaster
- func NewOrchestrator(n *LivepeerNode) *orchestrator
- func RandomVideoID() []byte
- func SignedSegmentToBytes(ss SignedSegment) ([]byte, error)
- type BasicVideoSource
- func (c *BasicVideoSource) DeleteCache(strmID StreamID)
- func (c *BasicVideoSource) EvictHLSMasterPlaylist(manifestID ManifestID)
- func (c *BasicVideoSource) EvictHLSStream(streamID StreamID) error
- func (c *BasicVideoSource) GetCache(strmID StreamID) (*segCache, bool)
- func (c *BasicVideoSource) GetHLSMasterPlaylist(manifestID ManifestID) *m3u8.MasterPlaylist
- func (c *BasicVideoSource) GetHLSMediaPlaylist(streamID StreamID) *m3u8.MediaPlaylist
- func (c *BasicVideoSource) GetHLSSegment(streamID StreamID, segName string) *stream.HLSSegment
- func (c *BasicVideoSource) GetNodeStatus() *net.NodeStatus
- func (c *BasicVideoSource) InsertHLSSegment(streamID StreamID, seg *stream.HLSSegment)
- func (c *BasicVideoSource) UpdateHLSMasterPlaylist(manifestID ManifestID, mpl *m3u8.MasterPlaylist)
- type LivepeerNode
- func (n *LivepeerNode) CreateTranscodeJob(strmID StreamID, profiles []ffmpeg.VideoProfile, price *big.Int) (*ethTypes.Job, error)
- func (n *LivepeerNode) GetClaimManager(job *ethTypes.Job) (eth.ClaimManager, error)
- func (n *LivepeerNode) StartEthServices() error
- func (n *LivepeerNode) StopEthServices() error
- func (n *LivepeerNode) TranscodeSegment(job *ethTypes.Job, ss *SignedSegment) (*TranscodeResult, error)
- type ManifestID
- type NodeType
- type SegChanData
- type SegmentChan
- type SignedSegment
- type StreamID
- type TranscodeResult
- type VideoSource
Constants ¶
const (
HashLength = 32
)
const TranscodeLoopTimeout = 10 * time.Minute
Variables ¶
var DefaultJobLength = int64(5760) //Avg 1 day in 15 sec blocks
var ErrLivepeerNode = errors.New("ErrLivepeerNode")
var ErrManifestID = errors.New("ErrManifestID")
var ErrNotFound = errors.New("ErrNotFound")
var ErrStreamID = errors.New("ErrStreamID")
var ErrTranscode = errors.New("ErrTranscode")
var GetMasterPlaylistWaitTime = time.Second * 5
var GetMediaPlaylistWaitTime = time.Second * 10
var LivepeerVersion = "0.3.3-unstable"
var SegCacheLen = 10
Functions ¶
func NewBroadcaster ¶ added in v0.3.3
func NewBroadcaster(node *LivepeerNode, job *ethTypes.Job) *broadcaster
func NewOrchestrator ¶ added in v0.3.3
func NewOrchestrator(n *LivepeerNode) *orchestrator
func RandomVideoID ¶
func RandomVideoID() []byte
func SignedSegmentToBytes ¶
func SignedSegmentToBytes(ss SignedSegment) ([]byte, error)
Convenience function to convert between SignedSegments and byte slices to put on the wire.
Types ¶
type BasicVideoSource ¶ added in v0.3.3
type BasicVideoSource struct {
// contains filtered or unexported fields
}
func (*BasicVideoSource) DeleteCache ¶ added in v0.3.3
func (c *BasicVideoSource) DeleteCache(strmID StreamID)
func (*BasicVideoSource) EvictHLSMasterPlaylist ¶ added in v0.3.3
func (c *BasicVideoSource) EvictHLSMasterPlaylist(manifestID ManifestID)
func (*BasicVideoSource) EvictHLSStream ¶ added in v0.3.3
func (c *BasicVideoSource) EvictHLSStream(streamID StreamID) error
func (*BasicVideoSource) GetCache ¶ added in v0.3.3
func (c *BasicVideoSource) GetCache(strmID StreamID) (*segCache, bool)
func (*BasicVideoSource) GetHLSMasterPlaylist ¶ added in v0.3.3
func (c *BasicVideoSource) GetHLSMasterPlaylist(manifestID ManifestID) *m3u8.MasterPlaylist
func (*BasicVideoSource) GetHLSMediaPlaylist ¶ added in v0.3.3
func (c *BasicVideoSource) GetHLSMediaPlaylist(streamID StreamID) *m3u8.MediaPlaylist
func (*BasicVideoSource) GetHLSSegment ¶ added in v0.3.3
func (c *BasicVideoSource) GetHLSSegment(streamID StreamID, segName string) *stream.HLSSegment
func (*BasicVideoSource) GetNodeStatus ¶ added in v0.3.3
func (c *BasicVideoSource) GetNodeStatus() *net.NodeStatus
func (*BasicVideoSource) InsertHLSSegment ¶ added in v0.3.3
func (c *BasicVideoSource) InsertHLSSegment(streamID StreamID, seg *stream.HLSSegment)
func (*BasicVideoSource) UpdateHLSMasterPlaylist ¶ added in v0.3.3
func (c *BasicVideoSource) UpdateHLSMasterPlaylist(manifestID ManifestID, mpl *m3u8.MasterPlaylist)
type LivepeerNode ¶
type LivepeerNode struct { // Common fields VideoSource VideoSource Eth eth.LivepeerEthClient EthEventMonitor eth.EventMonitor EthServices map[string]eth.EventService WorkDir string NodeType NodeType Database *common.DB // Transcoder public fields ClaimManagers map[int64]eth.ClaimManager SegmentChans map[int64]SegmentChan Ipfs ipfs.IpfsApi ServiceURI *url.URL // contains filtered or unexported fields }
LivepeerNode handles videos going in and coming out of the Livepeer network.
func NewLivepeerNode ¶
func NewLivepeerNode(e eth.LivepeerEthClient, wd string, dbh *common.DB) (*LivepeerNode, error)
NewLivepeerNode creates a new Livepeer Node. Eth can be nil.
func (*LivepeerNode) CreateTranscodeJob ¶
func (n *LivepeerNode) CreateTranscodeJob(strmID StreamID, profiles []ffmpeg.VideoProfile, price *big.Int) (*ethTypes.Job, error)
CreateTranscodeJob creates the on-chain transcode job.
func (*LivepeerNode) GetClaimManager ¶ added in v0.3.3
func (n *LivepeerNode) GetClaimManager(job *ethTypes.Job) (eth.ClaimManager, error)
func (*LivepeerNode) StartEthServices ¶ added in v0.3.3
func (n *LivepeerNode) StartEthServices() error
func (*LivepeerNode) StopEthServices ¶ added in v0.3.3
func (n *LivepeerNode) StopEthServices() error
func (*LivepeerNode) TranscodeSegment ¶ added in v0.3.3
func (n *LivepeerNode) TranscodeSegment(job *ethTypes.Job, ss *SignedSegment) (*TranscodeResult, error)
type ManifestID ¶
type ManifestID string
ManifestID is VideoID
func MakeManifestID ¶
func MakeManifestID(id []byte) (ManifestID, error)
func (*ManifestID) GetVideoID ¶
func (id *ManifestID) GetVideoID() []byte
func (*ManifestID) IsValid ¶
func (id *ManifestID) IsValid() bool
func (ManifestID) String ¶
func (id ManifestID) String() string
type SegChanData ¶ added in v0.3.3
type SegChanData struct {
// contains filtered or unexported fields
}
type SegmentChan ¶ added in v0.3.3
type SegmentChan chan *SegChanData
type SignedSegment ¶
type SignedSegment struct { Seg stream.HLSSegment Sig []byte }
Segment and its signature by the broadcaster
func BytesToSignedSegment ¶
func BytesToSignedSegment(data []byte) (SignedSegment, error)
Convenience function to convert between SignedSegments and byte slices to put on the wire.
type StreamID ¶
type StreamID string
StreamID is VideoID|Rendition
func (*StreamID) GetRendition ¶
func (*StreamID) GetVideoID ¶
func (StreamID) ManifestIDFromStreamID ¶ added in v0.3.3
func (id StreamID) ManifestIDFromStreamID() (ManifestID, error)
type TranscodeResult ¶ added in v0.3.3
XXX maybe reuse protobuf response struct somehow
type VideoSource ¶ added in v0.3.3
type VideoSource interface { GetHLSMasterPlaylist(manifestID ManifestID) *m3u8.MasterPlaylist UpdateHLSMasterPlaylist(manifestID ManifestID, mpl *m3u8.MasterPlaylist) EvictHLSMasterPlaylist(manifestID ManifestID) GetHLSMediaPlaylist(streamID StreamID) *m3u8.MediaPlaylist InsertHLSSegment(streamID StreamID, seg *stream.HLSSegment) GetHLSSegment(streamID StreamID, segName string) *stream.HLSSegment EvictHLSStream(streamID StreamID) error GetNodeStatus() *net.NodeStatus }
func NewBasicVideoSource ¶ added in v0.3.3
func NewBasicVideoSource() VideoSource