worker

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PeerWorker

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

PeerWorker Set

func (*PeerWorker) AddAudioFwd

func (w *PeerWorker) AddAudioFwd(trackID *string)

AddAudioFwd to add new video fwd

func (*PeerWorker) AddConnection

func (w *PeerWorker) AddConnection(
	signalID *string,
	configs *peer.Configs,
	handleAddPeer func(signalID, role, peerConnectionID *string),
	handleFailedPeer func(signalID, role, peerConnectionID *string),
	handleCandidate func(signalID, peerConnectionID *string, candidate *webrtc.ICECandidate),
	handleOnNegotiationNeeded func(signalID, peerConnectionID, cookieID *string),
) (*peer.Peer, error)

AddConnection add new peer connection

func (*PeerWorker) AddConnections

func (w *PeerWorker) AddConnections(signalID *string)

AddConnections add new connections

func (*PeerWorker) AddDCConnection

func (w *PeerWorker) AddDCConnection(
	signalID *string,
	configs *peer.Configs,
	handleOnDatachannel func(pcID *string, d *webrtc.DataChannel),
	handleAddDCPeer func(signalID, role, peerConnectionID *string),
	handleFailedDCPeer func(signalID, role, peerConnectionID *string),
	handleCandidate func(signalID, peerConnectionID *string, candidate *webrtc.ICECandidate),
) (*peer.Peer, error)

AddDCConnection add new peer connection

func (*PeerWorker) AddUpList

func (w *PeerWorker) AddUpList(peerConnectionID *string, c *UpPeer)

AddUpList add new PeerUP

func (*PeerWorker) AddVideoFwd

func (w *PeerWorker) AddVideoFwd(trackID *string)

AddVideoFwd to add new video fwd

func (*PeerWorker) AppendUpList

func (w *PeerWorker) AppendUpList(pcID *string, obj *UpPeer)

AppendUpList linter

func (*PeerWorker) DeleteUpList

func (w *PeerWorker) DeleteUpList(peerConnectionID *string)

DeleteUpList delete peerUp

func (*PeerWorker) GetAllConnectionID

func (w *PeerWorker) GetAllConnectionID() map[string][]string

GetAllConnectionID return signalID - [streamID]

func (*PeerWorker) GetAudioReceiveTime

func (w *PeerWorker) GetAudioReceiveTime() map[string]int64

GetAudioReceiveTime linter

func (*PeerWorker) GetAudioReceiveTimeby

func (w *PeerWorker) GetAudioReceiveTimeby(trackID string) int64

GetAudioReceiveTimeby linter

func (*PeerWorker) GetConnection

func (w *PeerWorker) GetConnection(signalID, peerConnectionID *string) (*peer.Peer, error)

GetConnection couble be nil if not exist

func (*PeerWorker) GetConnections

func (w *PeerWorker) GetConnections(signalID *string) peer.Connections

GetConnections could be nil if not exist

func (*PeerWorker) GetRemoteTrack

func (w *PeerWorker) GetRemoteTrack(trackID *string) *webrtc.TrackRemote

GetRemoteTrack linter

func (*PeerWorker) GetStates

func (w *PeerWorker) GetStates() map[string]string

GetStates return all pcID - states

func (*PeerWorker) GetTrackMeta

func (w *PeerWorker) GetTrackMeta(trackID string) bool

GetTrackMeta to check track meta

func (*PeerWorker) GetVideoReceiveTime

func (w *PeerWorker) GetVideoReceiveTime() map[string]int64

GetVideoReceiveTime linter

func (*PeerWorker) GetVideoReceiveTimeby

func (w *PeerWorker) GetVideoReceiveTimeby(trackID string) int64

GetVideoReceiveTimeby linter

func (*PeerWorker) Register

func (w *PeerWorker) Register(
	signalID,
	peerConnectionID *string,
	videoTrackIDs,
	audioTrackIDs []string,
	errHandler func(signalID, peerConnectionID, trackID *string, reason string),
) error

Register a client to all video/audio fwd

func (*PeerWorker) RegisterAudio

func (w *PeerWorker) RegisterAudio(
	signalID,
	audioTrackID,
	peerConnectionID *string,
	errHandler func(signalID, peerConnectionID, trackID *string, reason string),
) error

RegisterAudio linter

func (*PeerWorker) RegisterVideo

func (w *PeerWorker) RegisterVideo(
	signalID,
	videoTrackID,
	peerConnectionID *string,
	errHandler func(signalID, peerConnectionID, trackID *string, reason string),
) error

RegisterVideo linter

func (*PeerWorker) RemoveConnection

func (w *PeerWorker) RemoveConnection(signalID, peerConnectionID, cookieID *string) error

RemoveConnection remove existing peer connection

func (*PeerWorker) RemoveConnections

func (w *PeerWorker) RemoveConnections(signalID *string)

RemoveConnections remove all connections

func (*PeerWorker) SetHandleNoConnection

func (w *PeerWorker) SetHandleNoConnection(handler func(signalID *string))

SetHandleNoConnection use for check peers doest have any peer

func (*PeerWorker) SetHandleReadDeadline

func (w *PeerWorker) SetHandleReadDeadline(f func(pcID, trackID *string, codec, kind string))

SetHandleReadDeadline linter

func (*PeerWorker) SetTrackMeta

func (w *PeerWorker) SetTrackMeta(trackID string, state bool)

SetTrackMeta to set track meta

func (*PeerWorker) SetUpList

func (w *PeerWorker) SetUpList(lst map[string]*UpPeer)

SetUpList linter

func (*PeerWorker) Start

func (w *PeerWorker) Start() error

Start linter

func (*PeerWorker) UnRegister

func (w *PeerWorker) UnRegister(peerConnectionID *string)

UnRegister all video and audio

func (*PeerWorker) UnRegisterAudio

func (w *PeerWorker) UnRegisterAudio(peerConnectionID, audioTrackID *string)

UnRegisterAudio linter

func (*PeerWorker) UnRegisterVideo

func (w *PeerWorker) UnRegisterVideo(peerConnectionID, videoTrackID *string)

UnRegisterVideo linter

type UpPeer

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

UpPeer to save mapping peer connection with video/audio up list

func (*UpPeer) GetAudioArr

func (u *UpPeer) GetAudioArr() []string

GetAudioArr linter

func (*UpPeer) GetAudioList

func (u *UpPeer) GetAudioList() map[string]string

GetAudioList linter

func (*UpPeer) GetVideoArr

func (u *UpPeer) GetVideoArr() []string

GetVideoArr linter

func (*UpPeer) GetVideoList

func (u *UpPeer) GetVideoList() map[string]string

GetVideoList linter

func (*UpPeer) SetAudioList

func (u *UpPeer) SetAudioList(arr map[string]string)

SetAudioList linter

func (*UpPeer) SetVideoList

func (u *UpPeer) SetVideoList(arr map[string]string)

SetVideoList linter

type Worker

type Worker interface {
	Start() error

	AddDCConnection(
		signalID *string,
		configs *peer.Configs,
		handleOnDatachannel func(pcID *string, d *webrtc.DataChannel),
		handleAddDCPeer func(signalID, role, peerConnectionID *string),
		handleFailedDCPeer func(signalID, role, peerConnectionID *string),
		handleCandidate func(signalID, peerConnectionID *string, candidate *webrtc.ICECandidate),
	) (*peer.Peer, error)

	AddConnection(
		signalID *string,
		configs *peer.Configs,
		handleAddPeer func(signalID, role, peerConnectionID *string),
		handleFailedPeer func(signalID, role, peerConnectionID *string),
		handleCandidate func(signalID, peerConnectionID *string, candidate *webrtc.ICECandidate),
		handleOnNegotiationNeeded func(signalID, peerConnectionID, cookieID *string),
	) (*peer.Peer, error)
	GetAllConnectionID() map[string][]string
	GetStates() map[string]string

	AddConnections(signalID *string)
	GetConnections(signalID *string) peer.Connections
	GetConnection(signalID, peerConnectionID *string) (*peer.Peer, error)
	RemoveConnection(signalID, peerConnectionID, cookieID *string) error
	RemoveConnections(signalID *string)

	UnRegister(peerConnectionID *string)
	UnRegisterVideo(peerConnectionID, trackID *string)
	UnRegisterAudio(peerConnectionID, trackID *string)

	AddVideoFwd(trackID *string)
	AddAudioFwd(trackID *string)

	// add the method add register, the given trackID could be null if register all
	Register(
		signalID,
		peerConnectionID *string,
		videoTrackIDs,
		audioTrackIDs []string,
		errHandler func(signalID, peerConnectionID, trackID *string, reason string),
	) error
	RegisterAudio(
		signalID,
		audioTrackID,
		peerConnectionID *string,
		errHandler func(signalID, peerConnectionID, trackID *string, reason string),
	) error
	RegisterVideo(
		signalID,
		videoTrackID,
		peerConnectionID *string,
		errHandler func(signalID, peerConnectionID, trackID *string, reason string),
	) error

	SetUpList(lst map[string]*UpPeer)
	DeleteUpList(peerConnectionID *string)
	AddUpList(peerConnectionID *string, c *UpPeer)
	AppendUpList(pcID *string, obj *UpPeer)

	GetRemoteTrack(trackID *string) *webrtc.TrackRemote
	SetHandleNoConnection(handler func(signalID *string))

	GetVideoReceiveTime() map[string]int64
	GetAudioReceiveTime() map[string]int64
	GetVideoReceiveTimeby(trackID string) int64
	GetAudioReceiveTimeby(trackID string) int64

	GetTrackMeta(trackID string) bool
	SetTrackMeta(trackID string, state bool)
	SetHandleReadDeadline(f func(pcID, trackID *string, codec, kind string))
}

Worker peer connection worker

func NewPeerWorker

func NewPeerWorker(
	nodeID *string,
	upList map[string]*UpPeer,
	logger utils.Log,
) Worker

NewPeerWorker linter

Jump to

Keyboard shortcuts

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