Documentation ¶
Index ¶
- Constants
- Variables
- func AddSimulcastVideoTracks(ctx, iceConnectedCtx context.Context, pc *webrtc.PeerConnection, ...) error
- func CountTracks(sdp string) int
- func CreatePeerPair(ctx context.Context, log logging.LeveledLogger, room *Room, ...) (*PC, *Client, stats.Getter, chan bool)
- func FlattenErrors(errs []error) error
- func GenerateID(length int) string
- func GenerateSecureToken() string
- func GetLocalIp() (net.IP, error)
- func GetMediaEngine() *webrtc.MediaEngine
- func GetReceiverStats(pc *webrtc.PeerConnection, statsGetter stats.Getter) map[webrtc.SSRC]stats.Stats
- func GetSenderStats(pc *webrtc.PeerConnection, statsGetter stats.Getter) map[webrtc.SSRC]stats.Stats
- func GetStaticAudioTrack(ctx, iceConnectedCtx context.Context, trackID, streamID string, loop bool) (*webrtc.TrackLocalStaticSample, chan bool)
- func GetStaticTracks(ctx, iceConnectedCtx context.Context, streamID string, loop bool) ([]*webrtc.TrackLocalStaticSample, chan bool)
- func GetStaticVideoTrack(ctx, iceConnectedCtx context.Context, trackID, streamID string, loop bool, ...) (*webrtc.TrackLocalStaticSample, chan bool)
- func GetUfragAndPass(sdp string) (ufrag, pass string)
- func IsKeyframe(codec string, packet *rtp.Packet) bool
- func IsRTPPacketLate(packetSeqNum uint16, lastSeqNum uint16) bool
- func Keyframe(codec string, packet *rtp.Packet) (bool, bool)
- func KeyframeDimensions(codec string, packet *rtp.Packet) (uint32, uint32)
- func LoadVp9Track(ctx context.Context, log logging.LeveledLogger, pc *webrtc.PeerConnection, ...) *webrtc.RTPSender
- func PayloaderForCodec(codec webrtc.RTPCodecCapability) (rtp.Payloader, error)
- func RegisterCodecs(m *webrtc.MediaEngine, codecs []string) error
- func RegisterDefaultCodecs(m *webrtc.MediaEngine) error
- func RegisterSimulcastHeaderExtensions(m *webrtc.MediaEngine, codecType webrtc.RTPCodecType)
- func SendMediaSamples(p rtp.Packetizer, sequencer rtp.Sequencer, ...) error
- func SetPeerConnectionTracks(ctx context.Context, peerConnection *webrtc.PeerConnection, ...)
- func StartStunServer(ctx context.Context, publicIP string) *turn.Server
- func StartTurnServer(ctx context.Context, publicIP string) *turn.Server
- func ThousandSeparator(n int) string
- type AudioTrack
- type BitrateConfigs
- type Cache
- type Client
- func (c *Client) AddICECandidate(candidate webrtc.ICECandidateInit) error
- func (c *Client) ClientTracks() map[string]iClientTrack
- func (c *Client) CompleteNegotiation(answer webrtc.SessionDescription)
- func (c *Client) Context() context.Context
- func (c *Client) EnableDebug()
- func (c *Client) End() error
- func (c *Client) GetEstimatedBandwidth() uint32
- func (c *Client) ID() string
- func (c *Client) InitNegotiation() *webrtc.SessionDescription
- func (c *Client) IsAllowNegotiation() bool
- func (c *Client) IsBridge() bool
- func (c *Client) IsDebugEnabled() bool
- func (c *Client) IsVADEnabled() bool
- func (c *Client) Name() string
- func (c *Client) Negotiate(offer webrtc.SessionDescription) (*webrtc.SessionDescription, error)
- func (c *Client) OnAllowedRemoteRenegotiation(callback func())
- func (c *Client) OnConnectionStateChanged(callback func(webrtc.PeerConnectionState))
- func (c *Client) OnIceCandidate(callback func(context.Context, *webrtc.ICECandidate))
- func (c *Client) OnJoined(callback func())
- func (c *Client) OnLeft(callback func())
- func (c *Client) OnNetworkConditionChanged(callback func(networkmonitor.NetworkConditionType))
- func (c *Client) OnRenegotiation(...)
- func (c *Client) OnTrackRemoved(callback func(sourceType string, track *webrtc.TrackLocalStaticRTP))
- func (c *Client) OnTracksAdded(callback func(addedTracks []ITrack))
- func (c *Client) OnTracksAvailable(callback func([]ITrack))
- func (c *Client) OnTracksReady(callback func([]ITrack))
- func (c *Client) OnVoiceReceivedDetected(callback func(activity voiceactivedetector.VoiceActivity))
- func (c *Client) OnVoiceSentDetected(callback func(activity voiceactivedetector.VoiceActivity))
- func (c *Client) PeerConnection() *PeerConnection
- func (c *Client) PublishedTracks() []ITrack
- func (c *Client) SFU() *SFU
- func (c *Client) SetName(name string)
- func (c *Client) SetQuality(quality QualityLevel)
- func (c *Client) SetReceivingBandwidthLimit(bandwidth uint32)
- func (c *Client) SetTracksSourceType(trackTypes map[string]TrackType)
- func (c *Client) Stats() ClientTrackStats
- func (c *Client) SubscribeTracks(req []SubscribeTrackRequest) error
- func (c *Client) Tracks() []ITrack
- func (c *Client) Type() string
- func (c *Client) UpdatePublisherBandwidth(bitrate uint32)
- type ClientOptions
- type ClientState
- type ClientStats
- func (c *ClientStats) GetReceiver(id, rid string) (stats.Stats, error)
- func (c *ClientStats) GetReceiverBitrate(id, rid string) (uint32, error)
- func (c *ClientStats) GetSender(id string) (stats.Stats, error)
- func (c *ClientStats) GetSenderBitrate(id string) (uint32, error)
- func (c *ClientStats) Receivers() map[string]stats.Stats
- func (c *ClientStats) Senders() map[string]stats.Stats
- func (c *ClientStats) SetReceiver(id, rid string, stats stats.Stats)
- func (c *ClientStats) SetSender(id string, stats stats.Stats)
- func (c *ClientStats) UpdateVoiceActivity(ts uint32, clockRate uint32)
- func (c *ClientStats) VoiceActivity() time.Duration
- type ClientTrackStats
- type ClientType
- type Data
- type DataChannelList
- type DataChannelOptions
- type Event
- type IExtension
- type IManagerExtension
- type IQualityPreset
- type IRemoteTrack
- type ITrack
- type InternalDataVAD
- type Manager
- func (m *Manager) AddExtension(extension IManagerExtension)
- func (m *Manager) Close()
- func (m *Manager) CloseRoom(id string) error
- func (m *Manager) Context() context.Context
- func (m *Manager) CreateRoomID() string
- func (m *Manager) GetRoom(id string) (*Room, error)
- func (m *Manager) Log() logging.LeveledLogger
- func (m *Manager) Name() string
- func (m *Manager) NewRoom(id, name, roomType string, opts RoomOptions) (*Room, error)
- func (m *Manager) RoomsCount() int
- type Metadata
- func (m *Metadata) Delete(key string) error
- func (m *Metadata) ForEach(f func(key string, value interface{}))
- func (m *Metadata) Get(key string) (interface{}, error)
- func (m *Metadata) OnChanged(f func(key string, value interface{})) *OnMetaChangedCallback
- func (m *Metadata) Set(key string, value interface{})
- type OnMetaChangedCallback
- type OperationType
- type Options
- type PC
- type Packet
- type PacketBuffers
- func (p *PacketBuffers) Add(pkt *rtppool.RetainablePacket) error
- func (p *PacketBuffers) Clear()
- func (p *PacketBuffers) Close()
- func (p *PacketBuffers) Flush() []*Packet
- func (p *PacketBuffers) Initiated() bool
- func (p *PacketBuffers) Last() *Packet
- func (p *PacketBuffers) Len() int
- func (p *PacketBuffers) MaxLatency() time.Duration
- func (p *PacketBuffers) MinLatency() time.Duration
- func (p *PacketBuffers) Pop() *Packet
- func (p *PacketBuffers) WaitAvailablePacket()
- type PeerConnection
- type PublishedTrack
- type QualityLevel
- type QualityPreset
- type QualityPresets
- type RelayTrack
- func (t *RelayTrack) Codec() webrtc.RTPCodecParameters
- func (t *RelayTrack) ID() string
- func (t *RelayTrack) IsRelay() bool
- func (t *RelayTrack) Kind() webrtc.RTPCodecType
- func (t *RelayTrack) Msid() string
- func (t *RelayTrack) PayloadType() webrtc.PayloadType
- func (t *RelayTrack) RID() string
- func (t *RelayTrack) Read(b []byte) (n int, attributes interceptor.Attributes, err error)
- func (t *RelayTrack) ReadRTP() (*rtp.Packet, interceptor.Attributes, error)
- func (t *RelayTrack) SSRC() webrtc.SSRC
- func (t *RelayTrack) SetReadDeadline(deadline time.Time) error
- func (t *RelayTrack) StreamID() string
- type Room
- func (r *Room) AddClient(id, name string, opts ClientOptions) (*Client, error)
- func (r *Room) AddExtension(extension IExtension)
- func (r *Room) BitrateConfigs() BitrateConfigs
- func (r *Room) Close() error
- func (r *Room) CodecPreferences() []string
- func (r *Room) Context() context.Context
- func (r *Room) CreateClientID() string
- func (r *Room) CreateDataChannel(label string, opts DataChannelOptions) error
- func (r *Room) ID() string
- func (r *Room) Kind() string
- func (r *Room) Meta() *Metadata
- func (r *Room) Name() string
- func (r *Room) OnClientJoined(callback func(client *Client))
- func (r *Room) OnClientLeft(callback func(client *Client))
- func (r *Room) OnRoomClosed(callback func(id string))
- func (r *Room) Options() RoomOptions
- func (r *Room) SFU() *SFU
- func (r *Room) Stats() RoomStats
- func (r *Room) StopClient(id string) error
- type RoomOptions
- type RoomStats
- type SFU
- func (s *SFU) AddRelayTrack(ctx context.Context, id, streamid, rid string, client *Client, ...) error
- func (s *SFU) AvailableTracks() []ITrack
- func (s *SFU) CreateDataChannel(label string, opts DataChannelOptions) error
- func (s *SFU) GetClient(id string) (*Client, error)
- func (s *SFU) GetClients() map[string]*Client
- func (s *SFU) NewClient(id, name string, opts ClientOptions) *Client
- func (s *SFU) OnClientAdded(callback func(*Client))
- func (s *SFU) OnClientRemoved(callback func(*Client))
- func (s *SFU) OnStopped(callback func())
- func (s *SFU) OnTracksAvailable(callback func(tracks []ITrack))
- func (s *SFU) PLIInterval() time.Duration
- func (s *SFU) Stop()
- func (s *SFU) TotalActiveSessions() int
- type SFUClients
- type SFUDataChannel
- type SFUDataChannelList
- type SimulcastTrack
- func (t *SimulcastTrack) AddRemoteTrack(track IRemoteTrack, minWait, maxWait time.Duration, stats stats.Getter, ...) *remoteTrack
- func (t *SimulcastTrack) ClientID() string
- func (t *SimulcastTrack) Context() context.Context
- func (t *SimulcastTrack) ID() string
- func (t *SimulcastTrack) IsProcessed() bool
- func (t *SimulcastTrack) IsRelay() bool
- func (t *SimulcastTrack) IsScaleable() bool
- func (t *SimulcastTrack) IsScreen() bool
- func (t *SimulcastTrack) IsSimulcast() bool
- func (t *SimulcastTrack) IsTrackComplete() bool
- func (t *SimulcastTrack) Kind() webrtc.RTPCodecType
- func (t *SimulcastTrack) MimeType() string
- func (t *SimulcastTrack) OnEnded(f func())
- func (t *SimulcastTrack) OnRead(callback func(interceptor.Attributes, *rtp.Packet, QualityLevel))
- func (t *SimulcastTrack) OnTrackComplete(f func())
- func (t *SimulcastTrack) PayloadType() webrtc.PayloadType
- func (t *SimulcastTrack) RIDHigh() string
- func (t *SimulcastTrack) RIDLow() string
- func (t *SimulcastTrack) RIDMid() string
- func (t *SimulcastTrack) Relay(f func(webrtc.SSRC, interceptor.Attributes, *rtp.Packet))
- func (t *SimulcastTrack) SSRCHigh() webrtc.SSRC
- func (t *SimulcastTrack) SSRCLow() webrtc.SSRC
- func (t *SimulcastTrack) SSRCMid() webrtc.SSRC
- func (t *SimulcastTrack) SetAsProcessed()
- func (t *SimulcastTrack) SetSourceType(sourceType TrackType)
- func (t *SimulcastTrack) SourceType() TrackType
- func (t *SimulcastTrack) StreamID() string
- func (t *SimulcastTrack) TotalTracks() int
- type StatTracks
- type SubscribeTrackRequest
- type Track
- func (t *Track) ClientID() string
- func (t *Track) Context() context.Context
- func (t *Track) ID() string
- func (t *Track) IsProcessed() bool
- func (t *Track) IsRelay() bool
- func (t *Track) IsScaleable() bool
- func (t *Track) IsScreen() bool
- func (t *Track) IsSimulcast() bool
- func (t *Track) Kind() webrtc.RTPCodecType
- func (t *Track) MimeType() string
- func (t *Track) OnEnded(f func())
- func (t *Track) OnRead(callback func(interceptor.Attributes, *rtp.Packet, QualityLevel))
- func (t *Track) PayloadType() webrtc.PayloadType
- func (t *Track) Relay(f func(webrtc.SSRC, interceptor.Attributes, *rtp.Packet))
- func (t *Track) RemoteTrack() *remoteTrack
- func (t *Track) SSRC() webrtc.SSRC
- func (t *Track) SSRCHigh() webrtc.SSRC
- func (t *Track) SSRCLow() webrtc.SSRC
- func (t *Track) SSRCMid() webrtc.SSRC
- func (t *Track) SetAsProcessed()
- func (t *Track) SetSourceType(sourceType TrackType)
- func (t *Track) SourceType() TrackType
- func (t *Track) StreamID() string
- func (t *Track) TotalTracks() int
- type TrackReceivedStats
- type TrackSentStats
- type TrackStats
- type TrackType
- type UDPMux
Constants ¶
const ( ClientStateNew = 0 ClientStateActive = 1 ClientStateRestart = 2 ClientStateEnded = 3 ClientTypePeer = "peer" ClientTypeUpBridge = "upbridge" ClientTypeDownBridge = "downbridge" QualityAudioRed = 11 QualityAudio = 10 QualityHigh = 9 QualityHighMid = 8 QualityHighLow = 7 QualityMid = 6 QualityMidMid = 5 QualityMidLow = 4 QualityLow = 3 QualityLowMid = 2 QualityLowLow = 1 QualityNone = 0 )
const ( KEEPLAYER = OperationType(0) SCALEDOWNLAYER = OperationType(1) SCALEUPLAYER = OperationType(2) )
const ( StateRoomOpen = "open" StateRoomClosed = "closed" EventRoomClosed = "room_closed" EventRoomClientLeft = "room_client_left" )
const ( TrackTypeMedia = "media" TrackTypeScreen = "screen" )
const (
DefaultReceiveBitrate = 1_500_000
)
const (
SdesRepairRTPStreamIDURI = "urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id"
)
Variables ¶
var ( ErrAlreadyClaimed = errors.New("bwcontroller: already claimed") ErrorInsufficientBandwidth = errors.New("bwcontroller: bandwidth is insufficient") )
var ( ErrNegotiationIsNotRequested = errors.New("client: error negotiation is called before requested") ErrRenegotiationCallback = errors.New("client: error renegotiation callback is not set") ErrClientStoped = errors.New("client: error client already stopped") )
var ( ErrIncompleteRedHeader = errors.New("util: incomplete RED header") ErrIncompleteRedBlock = errors.New("util: incomplete RED block") )
var ( H264KeyFrame2x2SPS = []byte{ 0x67, 0x42, 0xc0, 0x1f, 0x0f, 0xd9, 0x1f, 0x88, 0x88, 0x84, 0x00, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00, 0x03, 0x00, 0xc8, 0x3c, 0x60, 0xc9, 0x20, } H264KeyFrame2x2PPS = []byte{ 0x68, 0x87, 0xcb, 0x83, 0xcb, 0x20, } H264KeyFrame2x2IDR = []byte{ 0x65, 0x88, 0x84, 0x0a, 0xf2, 0x62, 0x80, 0x00, 0xa7, 0xbe, } H264KeyFrame2x2 = [][]byte{H264KeyFrame2x2SPS, H264KeyFrame2x2PPS, H264KeyFrame2x2IDR} OpusSilenceFrame = []byte{ 0xf8, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, } )
var ( ErrClientNotFound = errors.New("client not found") ErrClientExists = errors.New("client already exists") ErrRoomIsClosed = errors.New("room is closed") ErrRoomIsNotEmpty = errors.New("room is not empty") ErrDecodingData = errors.New("error decoding data") ErrEncodingData = errors.New("error encoding data") ErrNotFound = errors.New("not found") )
var ( ErrRoomNotFound = errors.New("manager: room not found") ErrRoomAlreadyExists = errors.New("manager: room already exists") ErrRemoteRoomConnectTimeout = errors.New("manager: timeout connecting to remote room") RoomTypeLocal = "local" RoomTypeRemote = "remote" )
var ( ErrPacketTooLate = errors.New("packetbuffers: packet is too late") ErrPacketDuplicate = errors.New("packetbuffers: packet is duplicate") )
var ( ErrCantDecide = errors.New("can't decide if upscale or downscale the layer") ErrDuplicate = errors.New("packet sequence already exists in the cache") )
var ( ErrTrackExists = errors.New("client: error track already exists") ErrTrackIsNotExists = errors.New("client: error track is not exists") )
var DefaultQualityPresets = map[QualityLevel]QualityPreset{ QualityHigh: QualityPreset{ SID: 2, TID: 2, }, QualityHighMid: QualityPreset{ SID: 2, TID: 1, }, QualityHighLow: QualityPreset{ SID: 2, TID: 0, }, QualityMid: QualityPreset{ SID: 1, TID: 2, }, QualityMidMid: QualityPreset{ SID: 1, TID: 1, }, QualityMidLow: QualityPreset{ SID: 1, TID: 0, }, QualityLow: QualityPreset{ SID: 0, TID: 2, }, QualityLowMid: QualityPreset{ SID: 0, TID: 1, }, QualityLowLow: QualityPreset{ SID: 0, TID: 0, }, QualityNone: QualityPreset{ SID: 0, TID: 0, }, }
var (
ErrCLientStatsNotFound = errors.New("client stats not found")
)
var (
ErrDataChannelExists = errors.New("error: data channel already exists")
)
var (
ErrMetaNotFound = errors.New("meta: metadata not found")
)
Functions ¶
func AddSimulcastVideoTracks ¶
func CountTracks ¶
func CreatePeerPair ¶
func FlattenErrors ¶
func GenerateID ¶
func GenerateSecureToken ¶
func GenerateSecureToken() string
func GetLocalIp ¶
func GetMediaEngine ¶
func GetMediaEngine() *webrtc.MediaEngine
func GetReceiverStats ¶
func GetSenderStats ¶
func GetStaticAudioTrack ¶
func GetStaticTracks ¶
func GetStaticVideoTrack ¶
func GetUfragAndPass ¶
func IsRTPPacketLate ¶
func Keyframe ¶
This keyframe related code is taken from https://github.com/jech/galene/blob/cc2ed144843ef5ebc4353b7096708355cab3b992/codecs/codecs.go#L17 all credits belongs to Juliusz Chroboczek @jech the creator of Galene
Keyframe determines if packet is the start of a keyframe. It returns (true, true) if that is the case, (false, true) if that is definitely not the case, and (false, false) if the information cannot be determined.
func KeyframeDimensions ¶
func LoadVp9Track ¶
func PayloaderForCodec ¶
reuse from pion media engine and media sample
func RegisterCodecs ¶
func RegisterDefaultCodecs ¶
func RegisterDefaultCodecs(m *webrtc.MediaEngine) error
func RegisterSimulcastHeaderExtensions ¶
func RegisterSimulcastHeaderExtensions(m *webrtc.MediaEngine, codecType webrtc.RTPCodecType)
func SendMediaSamples ¶
func SetPeerConnectionTracks ¶
func StartStunServer ¶
func StartTurnServer ¶
func ThousandSeparator ¶
Types ¶
type AudioTrack ¶
type AudioTrack struct { *Track // contains filtered or unexported fields }
func (*AudioTrack) OnVoiceDetected ¶
func (t *AudioTrack) OnVoiceDetected(callback func(pkts []voiceactivedetector.VoicePacketData))
func (*AudioTrack) SetVAD ¶
func (t *AudioTrack) SetVAD(vad *voiceactivedetector.VoiceDetector)
type BitrateConfigs ¶
type BitrateConfigs struct { AudioRed uint32 `json:"audio_red" example:"75000"` Audio uint32 `json:"audio" example:"48000"` Video uint32 `json:"video" example:"1200000"` VideoHigh uint32 `json:"video_high" example:"1200000"` VideoHighPixels uint32 `json:"video_high_pixels" example:"921600"` VideoMid uint32 `json:"video_mid" example:"500000"` VideoMidPixels uint32 `json:"video_mid_pixels" example:"259200"` VideoLow uint32 `json:"video_low" example:"150000"` VideoLowPixels uint32 `json:"video_low_pixels" example:"64800"` InitialBandwidth uint32 `json:"initial_bandwidth" example:"1000000"` }
BitrateConfigs is the configuration for the bitrate that will be used for adaptive bitrates controller The paramenter is in bps (bit per second) for non pixels parameters. For pixels parameters, it is total pixels (width * height) of the video. High, Mid, and Low are the references for bitrate controller to decide the max bitrate to send to the client.
func DefaultBitrates ¶
func DefaultBitrates() BitrateConfigs
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func CreateDataPair ¶
func NewClient ¶
func NewClient(s *SFU, id string, name string, peerConnectionConfig webrtc.Configuration, opts ClientOptions) *Client
func (*Client) AddICECandidate ¶
func (*Client) ClientTracks ¶
func (*Client) CompleteNegotiation ¶
func (c *Client) CompleteNegotiation(answer webrtc.SessionDescription)
func (*Client) EnableDebug ¶
func (c *Client) EnableDebug()
func (*Client) GetEstimatedBandwidth ¶
GetEstimatedBandwidth returns the estimated bandwidth in bits per second based on Google Congestion Controller estimation. If the congestion controller is not enabled, it will return the initial bandwidth. If the receiving bandwidth is not 0, it will return the smallest value between the estimated bandwidth and the receiving bandwidth.
func (*Client) InitNegotiation ¶
func (c *Client) InitNegotiation() *webrtc.SessionDescription
Init and Complete negotiation is used for bridging the room between servers
func (*Client) IsAllowNegotiation ¶
ask if allowed for remote negotiation is required before call negotiation to make sure there is no racing condition of negotiation between local and remote clients. return false means the negotiation is in process, the requester must have a mechanism to repeat the request once it's done. requesting this must be followed by calling Negotate() to make sure the state is completed. Failed on called Negotiate() will cause the client to be in inconsistent state.
func (*Client) IsDebugEnabled ¶
func (*Client) IsVADEnabled ¶
func (*Client) OnAllowedRemoteRenegotiation ¶
func (c *Client) OnAllowedRemoteRenegotiation(callback func())
OnAllowedRemoteRenegotiation event is called when the SFU is done with the renegotiation and ready to receive the renegotiation from the client. Use this event to trigger the client to do renegotiation if needed.
func (*Client) OnConnectionStateChanged ¶
func (c *Client) OnConnectionStateChanged(callback func(webrtc.PeerConnectionState))
OnConnectionStateChanged event is called when the SFU connection state is changed. The callback will receive the connection state as the new state.
func (*Client) OnIceCandidate ¶
OnTracksAvailable event is called when the SFU has ice candidate that need to pass to the client. This event will triggered during negotiation process to exchanges ice candidates between SFU and client. The client can also pass the ice candidate to the SFU using `client.AddICECandidate()` method.
func (*Client) OnJoined ¶
func (c *Client) OnJoined(callback func())
OnJoined event is called when the client is joined to the room. This doesn't mean that the client's tracks are already published to the room. This event can be use to track number of clients in the room.
func (*Client) OnLeft ¶
func (c *Client) OnLeft(callback func())
OnLeft event is called when the client is left from the room. This event can be use to track number of clients in the room.
func (*Client) OnNetworkConditionChanged ¶
func (c *Client) OnNetworkConditionChanged(callback func(networkmonitor.NetworkConditionType))
func (*Client) OnRenegotiation ¶
func (c *Client) OnRenegotiation(callback func(context.Context, webrtc.SessionDescription) (webrtc.SessionDescription, error))
OnRenegotiation event is called when the SFU is trying to renegotiate with the client. The callback will receive the SDP offer from the SFU that must be use to create the SDP answer from the client. The SDP answer then can be passed back to the SFU using `client.CompleteNegotiation()` method.
func (*Client) OnTrackRemoved ¶
func (c *Client) OnTrackRemoved(callback func(sourceType string, track *webrtc.TrackLocalStaticRTP))
OnTrackRemoved event is called when the client's track is removed from the room. Usually this triggered when the client is disconnected from the room or a track is unpublished from the client.
func (*Client) OnTracksAdded ¶
OnTrackAdded event is to confirmed the source type of the pending published tracks. If the event is not listened, the pending published tracks will be ignored and not published to other clients. Once received, respond with `client.SetTracksSourceType()“ to confirm the source type of the pending published tracks
func (*Client) OnTracksAvailable ¶
OnTracksAvailable event is called when the SFU is trying to publish new tracks to the client. The client then can subscribe to the tracks by calling `client.SubscribeTracks()` method. The callback will receive the list of tracks from other clients that are available to subscribe.
func (*Client) OnTracksReady ¶
OnTracksReady event is called when the client's tracks are use from the client This can be use to hook a processing like transcription/video processing to client published tracks
func (*Client) OnVoiceReceivedDetected ¶
func (c *Client) OnVoiceReceivedDetected(callback func(activity voiceactivedetector.VoiceActivity))
func (*Client) OnVoiceSentDetected ¶
func (c *Client) OnVoiceSentDetected(callback func(activity voiceactivedetector.VoiceActivity))
OnVoiceDetected event is called when the SFU is detecting voice activity in the room. The callback will receive the voice activity data that can be use for visual indicator of current speaker.
func (*Client) PeerConnection ¶
func (c *Client) PeerConnection() *PeerConnection
func (*Client) PublishedTracks ¶
func (*Client) SetName ¶
SetName update the name of the client, that previously set on create client The name then later can use by call client.Name() method
func (*Client) SetQuality ¶
func (c *Client) SetQuality(quality QualityLevel)
SetQuality method is to set the maximum quality of the video that will be sent to the client. This is for bandwidth efficiency purpose and use when the video is rendered in smaller size than the original size.
func (*Client) SetReceivingBandwidthLimit ¶
SetReceivingBandwidthLimit will cap the receiving bandwidth and will overide the bandwidth estimation if the value is lower than the estimated bandwidth. This is useful to test how the SFU will behave when the bandwidth is limited
func (*Client) SetTracksSourceType ¶
SetTracksSourceType set the source type of the pending published tracks. This function must be called after receiving OnTracksAdded event. The source type can be "media" or "screen" Calling this method will trigger `client.OnTracksAvailable` event to other clients. The other clients then can subscribe the tracks using `client.SubscribeTracks()` method.
func (*Client) Stats ¶
func (c *Client) Stats() ClientTrackStats
TODO: fix the panic nil here when the client is ended
func (*Client) SubscribeTracks ¶
func (c *Client) SubscribeTracks(req []SubscribeTrackRequest) error
SubscribeTracks subscribe tracks from other clients that are published to this client The client must listen for `client.OnTracksAvailable` to know if a new track is available to subscribe. Calling subscribe tracks will trigger the SFU renegotiation with the client.
func (*Client) UpdatePublisherBandwidth ¶
This should get from the publisher client using RTCIceCandidatePairStats.availableOutgoingBitrate from client stats. It should be done through DataChannel so it won't required additional implementation on API endpoints where this SFU is used.
type ClientOptions ¶
type ClientOptions struct { IceTrickle bool `json:"ice_trickle"` IdleTimeout time.Duration `json:"idle_timeout"` Type string `json:"type"` EnableVoiceDetection bool `json:"enable_voice_detection"` EnablePlayoutDelay bool `json:"enable_playout_delay"` EnableOpusDTX bool `json:"enable_opus_dtx"` EnableOpusInbandFEC bool `json:"enable_opus_inband_fec"` // Configure the minimum playout delay that will be used by the client // Recommendation: // 0 ms: Certain gaming scenarios (likely without audio) where we will want to play the frame as soon as possible. Also, for remote desktop without audio where rendering a frame asap makes sense // 100/150/200 ms: These could be the max target latency for interactive streaming use cases depending on the actual application (gaming, remoting with audio, interactive scenarios) // 400 ms: Application that want to ensure a network glitch has very little chance of causing a freeze can start with a minimum delay target that is high enough to deal with network issues. Video streaming is one example. MinPlayoutDelay uint16 `json:"min_playout_delay"` // Configure the minimum playout delay that will be used by the client // Recommendation: // 0 ms: Certain gaming scenarios (likely without audio) where we will want to play the frame as soon as possible. Also, for remote desktop without audio where rendering a frame asap makes sense // 100/150/200 ms: These could be the max target latency for interactive streaming use cases depending on the actual application (gaming, remoting with audio, interactive scenarios) // 400 ms: Application that want to ensure a network glitch has very little chance of causing a freeze can start with a minimum delay target that is high enough to deal with network issues. Video streaming is one example. MaxPlayoutDelay uint16 `json:"max_playout_delay"` JitterBufferMinWait time.Duration `json:"jitter_buffer_min_wait"` JitterBufferMaxWait time.Duration `json:"jitter_buffer_max_wait"` // On unstable network, the packets can be arrived unordered which may affected the nack and packet loss counts, set this to true to allow the SFU to handle reordered packet ReorderPackets bool `json:"reorder_packets"` Log logging.LeveledLogger // contains filtered or unexported fields }
func DefaultClientOptions ¶
func DefaultClientOptions() ClientOptions
type ClientState ¶
type ClientState int
type ClientStats ¶
type ClientStats struct { Client *Client *TrackStats // contains filtered or unexported fields }
func (*ClientStats) GetReceiver ¶
func (c *ClientStats) GetReceiver(id, rid string) (stats.Stats, error)
func (*ClientStats) GetReceiverBitrate ¶
func (c *ClientStats) GetReceiverBitrate(id, rid string) (uint32, error)
func (*ClientStats) GetSenderBitrate ¶
func (c *ClientStats) GetSenderBitrate(id string) (uint32, error)
func (*ClientStats) SetReceiver ¶
func (c *ClientStats) SetReceiver(id, rid string, stats stats.Stats)
func (*ClientStats) UpdateVoiceActivity ¶
func (c *ClientStats) UpdateVoiceActivity(ts uint32, clockRate uint32)
UpdateVoiceActivity updates voice activity duration 0 timestamp means ended
func (*ClientStats) VoiceActivity ¶
func (c *ClientStats) VoiceActivity() time.Duration
type ClientTrackStats ¶
type ClientTrackStats struct { ID string `json:"id"` Name string `json:"name"` PublisherBandwidth uint32 `json:"publisher_bandwidth"` ConsumerBandwidth uint32 `json:"consumer_bandwidth"` CurrentConsumerBitrate uint32 `json:"current_bitrate"` CurrentPublishLimitation string `json:"current_publish_limitation"` Sents []TrackSentStats `json:"sent_track_stats"` Receives []TrackReceivedStats `json:"received_track_stats"` // in milliseconds VoiceActivityDurationMS uint32 `json:"voice_activity_duration_ms"` }
type ClientType ¶
type ClientType string
type DataChannelList ¶
type DataChannelList struct {
// contains filtered or unexported fields
}
func NewDataChannelList ¶
func NewDataChannelList(ctx context.Context) *DataChannelList
func (*DataChannelList) Add ¶
func (d *DataChannelList) Add(dc *webrtc.DataChannel)
func (*DataChannelList) Clear ¶
func (d *DataChannelList) Clear()
func (*DataChannelList) Get ¶
func (d *DataChannelList) Get(label string) *webrtc.DataChannel
func (*DataChannelList) Remove ¶
func (d *DataChannelList) Remove(dc *webrtc.DataChannel)
type DataChannelOptions ¶
func DefaultDataChannelOptions ¶
func DefaultDataChannelOptions() DataChannelOptions
type IExtension ¶
type IManagerExtension ¶
type IManagerExtension interface { // only the first extension that returns a room or an error will be used, once a room or an error is returned, the rest of the extensions will be ignored OnGetRoom(manager *Manager, roomID string) (*Room, error) // this can be use for authentication before a room is created OnBeforeNewRoom(id, name, roomType string) error OnNewRoom(manager *Manager, room *Room) OnRoomClosed(manager *Manager, room *Room) }
type IQualityPreset ¶
type IRemoteTrack ¶
type IRemoteTrack interface { ID() string RID() string PayloadType() webrtc.PayloadType Kind() webrtc.RTPCodecType StreamID() string SSRC() webrtc.SSRC Msid() string Codec() webrtc.RTPCodecParameters Read(b []byte) (n int, attributes interceptor.Attributes, err error) ReadRTP() (*rtp.Packet, interceptor.Attributes, error) SetReadDeadline(deadline time.Time) error }
func NewTrackRelay ¶
func NewTrackRelay(id, streamid, rid string, kind webrtc.RTPCodecType, ssrc webrtc.SSRC, mimeType string, rtpChan chan *rtp.Packet) IRemoteTrack
type ITrack ¶
type ITrack interface { ID() string StreamID() string ClientID() string IsSimulcast() bool IsScaleable() bool IsProcessed() bool SetSourceType(TrackType) SourceType() TrackType SetAsProcessed() OnRead(func(interceptor.Attributes, *rtp.Packet, QualityLevel)) IsScreen() bool IsRelay() bool Kind() webrtc.RTPCodecType MimeType() string TotalTracks() int Context() context.Context Relay(func(webrtc.SSRC, interceptor.Attributes, *rtp.Packet)) PayloadType() webrtc.PayloadType OnEnded(func()) }
type InternalDataVAD ¶
type InternalDataVAD struct { Type string `json:"type"` Data voiceactivedetector.VoiceActivity `json:"data"` }
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is a struct that manages all the rooms
func (*Manager) AddExtension ¶
func (m *Manager) AddExtension(extension IManagerExtension)
func (*Manager) Close ¶
func (m *Manager) Close()
Close will close all room and canceling the context
func (*Manager) CloseRoom ¶
CloseRoom will stop all clients in the room and close it. This is a shortcut to find a room with id and close it.
func (*Manager) CreateRoomID ¶
func (*Manager) Log ¶
func (m *Manager) Log() logging.LeveledLogger
func (*Manager) NewRoom ¶
func (m *Manager) NewRoom(id, name, roomType string, opts RoomOptions) (*Room, error)
func (*Manager) RoomsCount ¶
type Metadata ¶
type Metadata struct {
// contains filtered or unexported fields
}
func NewMetadata ¶
func NewMetadata() *Metadata
func (*Metadata) OnChanged ¶
func (m *Metadata) OnChanged(f func(key string, value interface{})) *OnMetaChangedCallback
OnChanged registers a callback to be called when a metadata is changed Make sure OnMetaChangedSubscription.Unsubscribe() is called when the callback is no longer needed
type OnMetaChangedCallback ¶
type OnMetaChangedCallback struct {
// contains filtered or unexported fields
}
func (*OnMetaChangedCallback) Remove ¶
func (s *OnMetaChangedCallback) Remove()
Unsubscribe removes the callback from the metadata Make sure to call the method once the callback is no longer needed
type OperationType ¶
type OperationType uint8
type Options ¶
type Options struct { EnableBridging bool EnableBandwidthEstimator bool IceServers []webrtc.ICEServer MinPlayoutDelay uint16 MaxPlayoutDelay uint16 // SettingEngine is used to configure the WebRTC engine // Use this to configure use of enable/disable mDNS, network types, use single port mux, etc. SettingEngine *webrtc.SettingEngine }
func DefaultOptions ¶
func DefaultOptions() Options
type Packet ¶
type Packet struct { Packet *rtppool.RetainablePacket // contains filtered or unexported fields }
type PacketBuffers ¶
type PacketBuffers struct {
// contains filtered or unexported fields
}
buffer ring for cached packets
func NewPacketBuffers ¶
func NewPacketBuffers(ctx context.Context, minLatency, maxLatency time.Duration, dynamicLatency bool, log logging.LeveledLogger) *PacketBuffers
func (*PacketBuffers) Add ¶
func (p *PacketBuffers) Add(pkt *rtppool.RetainablePacket) error
func (*PacketBuffers) Clear ¶
func (p *PacketBuffers) Clear()
func (*PacketBuffers) Close ¶
func (p *PacketBuffers) Close()
func (*PacketBuffers) Flush ¶
func (p *PacketBuffers) Flush() []*Packet
func (*PacketBuffers) Initiated ¶
func (p *PacketBuffers) Initiated() bool
func (*PacketBuffers) Last ¶
func (p *PacketBuffers) Last() *Packet
func (*PacketBuffers) Len ¶
func (p *PacketBuffers) Len() int
func (*PacketBuffers) MaxLatency ¶
func (p *PacketBuffers) MaxLatency() time.Duration
func (*PacketBuffers) MinLatency ¶
func (p *PacketBuffers) MinLatency() time.Duration
func (*PacketBuffers) Pop ¶
func (p *PacketBuffers) Pop() *Packet
func (*PacketBuffers) WaitAvailablePacket ¶
func (p *PacketBuffers) WaitAvailablePacket()
type PeerConnection ¶
type PeerConnection struct {
// contains filtered or unexported fields
}
func (*PeerConnection) AddTrack ¶
func (p *PeerConnection) AddTrack(track *webrtc.TrackLocalStaticRTP) (*webrtc.RTPSender, error)
func (*PeerConnection) Close ¶
func (p *PeerConnection) Close() error
func (*PeerConnection) PC ¶
func (p *PeerConnection) PC() *webrtc.PeerConnection
func (*PeerConnection) RemoveTrack ¶
func (p *PeerConnection) RemoveTrack(sender *webrtc.RTPSender) error
type PublishedTrack ¶
type PublishedTrack struct { ClientID string Track webrtc.TrackLocal }
type QualityLevel ¶
type QualityLevel uint32
func DefaultQualityLevels ¶
func DefaultQualityLevels() []QualityLevel
func RIDToQuality ¶
func RIDToQuality(RID string) QualityLevel
func Uint32ToQualityLevel ¶
func Uint32ToQualityLevel(quality uint32) QualityLevel
type QualityPreset ¶
func (QualityPreset) GetSID ¶
func (q QualityPreset) GetSID() uint8
func (QualityPreset) GetTID ¶
func (q QualityPreset) GetTID() uint8
type QualityPresets ¶
type QualityPresets struct { High QualityPreset `json:"high"` HighMid QualityPreset `json:"highmid"` HighLow QualityPreset `json:"highlow"` Mid QualityPreset `json:"mid"` MidMid QualityPreset `json:"midmid"` MidLow QualityPreset `json:"midlow"` Low QualityPreset `json:"low"` LowMid QualityPreset `json:"lowmid"` LowLow QualityPreset `json:"lowlow"` }
type RelayTrack ¶
type RelayTrack struct {
// contains filtered or unexported fields
}
TrackRemote represents a single inbound source of media
func (*RelayTrack) Codec ¶
func (t *RelayTrack) Codec() webrtc.RTPCodecParameters
Codec gets the Codec of the track
func (*RelayTrack) ID ¶
func (t *RelayTrack) ID() string
ID is the unique identifier for this Track. This should be unique for the stream, but doesn't have to globally unique. A common example would be 'audio' or 'video' and StreamID would be 'desktop' or 'webcam'
func (*RelayTrack) IsRelay ¶
func (t *RelayTrack) IsRelay() bool
IsRelay returns true if this track is a relay track
func (*RelayTrack) Kind ¶
func (t *RelayTrack) Kind() webrtc.RTPCodecType
Kind gets the Kind of the track
func (*RelayTrack) PayloadType ¶
func (t *RelayTrack) PayloadType() webrtc.PayloadType
PayloadType gets the PayloadType of the track
func (*RelayTrack) RID ¶
func (t *RelayTrack) RID() string
RID gets the RTP Stream ID of this Track With Simulcast you will have multiple tracks with the same ID, but different RID values. In many cases a TrackRemote will not have an RID, so it is important to assert it is non-zero
func (*RelayTrack) Read ¶
func (t *RelayTrack) Read(b []byte) (n int, attributes interceptor.Attributes, err error)
Read reads data from the track.
func (*RelayTrack) ReadRTP ¶
func (t *RelayTrack) ReadRTP() (*rtp.Packet, interceptor.Attributes, error)
ReadRTP is a convenience method that wraps Read and unmarshals for you.
func (*RelayTrack) SetReadDeadline ¶
func (t *RelayTrack) SetReadDeadline(deadline time.Time) error
SetReadDeadline sets the max amount of time the RTP stream will block before returning. 0 is forever.
func (*RelayTrack) StreamID ¶
func (t *RelayTrack) StreamID() string
StreamID is the group this track belongs too. This must be unique
type Room ¶
type Room struct { RenegotiationChan map[string]chan bool OnEvent func(event Event) // contains filtered or unexported fields }
func (*Room) AddClient ¶
func (r *Room) AddClient(id, name string, opts ClientOptions) (*Client, error)
func (*Room) AddExtension ¶
func (r *Room) AddExtension(extension IExtension)
func (*Room) BitrateConfigs ¶
func (r *Room) BitrateConfigs() BitrateConfigs
BitrateConfigs return the current bitrate configuration that used in bitrate controller Client should use this to configure the bitrate when publishing media tracks Inconsistent bitrate configuration between client and server will result missed bitrate calculation and could affecting packet loss and media quality
func (*Room) Close ¶
Close the room and stop all clients. All connected clients will stopped and removed from the room. All clients will get `connectionstateevent` with `closed` state. https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/connectionstatechange_event
func (*Room) CodecPreferences ¶
CodecPreferences return the current codec preferences that used in SFU Client should use this to configure the used codecs when publishing media tracks Inconsistent codec preferences between client and server can make the SFU cannot handle the codec properly
func (*Room) CreateClientID ¶
Generate a unique client ID for this room
func (*Room) CreateDataChannel ¶
func (r *Room) CreateDataChannel(label string, opts DataChannelOptions) error
func (*Room) OnClientJoined ¶
func (*Room) OnClientLeft ¶
Use this to get notified when a client is stopped and completly removed from the room
func (*Room) OnRoomClosed ¶
Use this to get notified when a room is closed
func (*Room) Options ¶
func (r *Room) Options() RoomOptions
func (*Room) Stats ¶
Get the room real time stats. This will return the current room stats. The client stats and it's tracks will be removed from the stats if the client or track is removed. But the aggregated stats will still be there and included in the room stats even if they're removed.
func (*Room) StopClient ¶
Stopping client is async, it will just stop the client and return immediately You should use OnClientLeft to get notified when the client is actually stopped
type RoomOptions ¶
type RoomOptions struct { // Configures the bitrates configuration that will be used by the room // Make sure to use the same bitrate config when publishing video because this is used to manage the usage bandwidth in this room Bitrates BitrateConfigs `json:"bitrates,omitempty"` // Configures the codecs that will be used by the room Codecs *[]string `` /* 145-byte string literal not displayed */ // Configures the interval in nanoseconds of sending PLIs to clients that will generate keyframe, default is 0 means it will use auto PLI request only when needed. // More often means more bandwidth usage but more stability on video quality when packet loss, but client libs supposed to request PLI automatically when needed. PLIInterval *time.Duration `json:"pli_interval_ns,omitempty" example:"0"` // Configure the mapping of spatsial and temporal layers to quality level // Use this to use scalable video coding (SVC) to control the bitrate level of the video QualityLevels []QualityLevel `json:"quality_levels,omitempty"` // Configure the timeout in nanonseconds when the room is empty it will close after the timeout exceeded. Default is 5 minutes EmptyRoomTimeout *time.Duration `json:"empty_room_timeout_ns,ompitempty" example:"300000000000" default:"300000000000"` }
func DefaultRoomOptions ¶
func DefaultRoomOptions() RoomOptions
type RoomStats ¶
type RoomStats struct { ActiveSessions int `json:"active_sessions"` ClientsCount int `json:"clients_count"` BitrateSent uint64 `json:"bitrate_sent"` BitrateReceived uint64 `json:"bitrate_received"` BytesIngress uint64 `json:"bytes_ingress"` BytesEgress uint64 `json:"bytes_egress"` ReceivedTracks StatTracks `json:"received_tracks"` SentTracks StatTracks `json:"sent_tracks"` Timestamp time.Time `json:"timestamp"` ClientStats map[string]ClientTrackStats `json:"client_stats"` }
type SFU ¶
type SFU struct {
// contains filtered or unexported fields
}
func (*SFU) AddRelayTrack ¶
func (*SFU) AvailableTracks ¶
func (*SFU) CreateDataChannel ¶
func (s *SFU) CreateDataChannel(label string, opts DataChannelOptions) error
func (*SFU) GetClients ¶
func (*SFU) OnClientAdded ¶
func (*SFU) OnClientRemoved ¶
func (*SFU) OnTracksAvailable ¶
func (*SFU) PLIInterval ¶
func (*SFU) TotalActiveSessions ¶
type SFUClients ¶
type SFUClients struct {
// contains filtered or unexported fields
}
func (*SFUClients) Add ¶
func (s *SFUClients) Add(client *Client) error
func (*SFUClients) GetClients ¶
func (s *SFUClients) GetClients() map[string]*Client
func (*SFUClients) Length ¶
func (s *SFUClients) Length() int
func (*SFUClients) Remove ¶
func (s *SFUClients) Remove(client *Client) error
type SFUDataChannel ¶
type SFUDataChannel struct {
// contains filtered or unexported fields
}
func NewSFUDataChannel ¶
func NewSFUDataChannel(label string, opts DataChannelOptions) *SFUDataChannel
func (*SFUDataChannel) ClientIDs ¶
func (s *SFUDataChannel) ClientIDs() []string
func (*SFUDataChannel) IsOrdered ¶
func (s *SFUDataChannel) IsOrdered() bool
type SFUDataChannelList ¶
type SFUDataChannelList struct {
// contains filtered or unexported fields
}
func NewSFUDataChannelList ¶
func NewSFUDataChannelList() *SFUDataChannelList
func (*SFUDataChannelList) Add ¶
func (s *SFUDataChannelList) Add(label string, opts DataChannelOptions) *SFUDataChannel
func (*SFUDataChannelList) Get ¶
func (s *SFUDataChannelList) Get(label string) *SFUDataChannel
func (*SFUDataChannelList) Remove ¶
func (s *SFUDataChannelList) Remove(dc *SFUDataChannel)
type SimulcastTrack ¶
type SimulcastTrack struct {
// contains filtered or unexported fields
}
func (*SimulcastTrack) AddRemoteTrack ¶
func (t *SimulcastTrack) AddRemoteTrack(track IRemoteTrack, minWait, maxWait time.Duration, stats stats.Getter, onStatsUpdated func(*stats.Stats), onPLI func()) *remoteTrack
func (*SimulcastTrack) ClientID ¶
func (t *SimulcastTrack) ClientID() string
func (*SimulcastTrack) Context ¶
func (t *SimulcastTrack) Context() context.Context
func (*SimulcastTrack) ID ¶
func (t *SimulcastTrack) ID() string
TODO: this is contain multiple tracks, there is a possibility remote track high is not available yet
func (*SimulcastTrack) IsProcessed ¶
func (t *SimulcastTrack) IsProcessed() bool
func (*SimulcastTrack) IsRelay ¶
func (t *SimulcastTrack) IsRelay() bool
func (*SimulcastTrack) IsScaleable ¶
func (t *SimulcastTrack) IsScaleable() bool
func (*SimulcastTrack) IsScreen ¶
func (t *SimulcastTrack) IsScreen() bool
func (*SimulcastTrack) IsSimulcast ¶
func (t *SimulcastTrack) IsSimulcast() bool
func (*SimulcastTrack) IsTrackComplete ¶
func (t *SimulcastTrack) IsTrackComplete() bool
func (*SimulcastTrack) Kind ¶
func (t *SimulcastTrack) Kind() webrtc.RTPCodecType
func (*SimulcastTrack) MimeType ¶
func (t *SimulcastTrack) MimeType() string
func (*SimulcastTrack) OnEnded ¶
func (t *SimulcastTrack) OnEnded(f func())
func (*SimulcastTrack) OnRead ¶
func (t *SimulcastTrack) OnRead(callback func(interceptor.Attributes, *rtp.Packet, QualityLevel))
func (*SimulcastTrack) OnTrackComplete ¶
func (t *SimulcastTrack) OnTrackComplete(f func())
func (*SimulcastTrack) PayloadType ¶
func (t *SimulcastTrack) PayloadType() webrtc.PayloadType
func (*SimulcastTrack) RIDHigh ¶
func (t *SimulcastTrack) RIDHigh() string
func (*SimulcastTrack) RIDLow ¶
func (t *SimulcastTrack) RIDLow() string
func (*SimulcastTrack) RIDMid ¶
func (t *SimulcastTrack) RIDMid() string
func (*SimulcastTrack) Relay ¶
func (t *SimulcastTrack) Relay(f func(webrtc.SSRC, interceptor.Attributes, *rtp.Packet))
func (*SimulcastTrack) SSRCHigh ¶
func (t *SimulcastTrack) SSRCHigh() webrtc.SSRC
func (*SimulcastTrack) SSRCLow ¶
func (t *SimulcastTrack) SSRCLow() webrtc.SSRC
func (*SimulcastTrack) SSRCMid ¶
func (t *SimulcastTrack) SSRCMid() webrtc.SSRC
func (*SimulcastTrack) SetAsProcessed ¶
func (t *SimulcastTrack) SetAsProcessed()
func (*SimulcastTrack) SetSourceType ¶
func (t *SimulcastTrack) SetSourceType(sourceType TrackType)
func (*SimulcastTrack) SourceType ¶
func (t *SimulcastTrack) SourceType() TrackType
func (*SimulcastTrack) StreamID ¶
func (t *SimulcastTrack) StreamID() string
func (*SimulcastTrack) TotalTracks ¶
func (t *SimulcastTrack) TotalTracks() int
type StatTracks ¶
type SubscribeTrackRequest ¶
type Track ¶
type Track struct {
// contains filtered or unexported fields
}
func (*Track) IsProcessed ¶
func (*Track) IsScaleable ¶
func (*Track) IsSimulcast ¶
func (*Track) OnRead ¶
func (t *Track) OnRead(callback func(interceptor.Attributes, *rtp.Packet, QualityLevel))
func (*Track) PayloadType ¶
func (t *Track) PayloadType() webrtc.PayloadType
func (*Track) Relay ¶
func (t *Track) Relay(f func(webrtc.SSRC, interceptor.Attributes, *rtp.Packet))
func (*Track) RemoteTrack ¶
func (t *Track) RemoteTrack() *remoteTrack
func (*Track) SetAsProcessed ¶
func (t *Track) SetAsProcessed()
func (*Track) SetSourceType ¶
func (*Track) SourceType ¶
func (*Track) TotalTracks ¶
type TrackReceivedStats ¶
type TrackReceivedStats struct { ID string `json:"id"` StreamID string `json:"stream_id"` RID string `json:"rid"` Kind webrtc.RTPCodecType `json:"kind"` Codec string `json:"codec"` CurrentBitrate uint32 `json:"current_bitrate"` PacketsLost int64 `json:"packets_lost"` PacketsReceived uint64 `json:"packets_received"` BytesReceived int64 `json:"bytes_received"` }
type TrackSentStats ¶
type TrackSentStats struct { ID string `json:"id"` StreamID string `json:"stream_id"` Kind webrtc.RTPCodecType `json:"kind"` Codec string `json:"codec"` PacketsLost int64 `json:"packets_lost"` PacketSent uint64 `json:"packets_sent"` FractionLost float64 `json:"fraction_lost"` BytesSent uint64 `json:"bytes_sent"` CurrentBitrate uint32 `json:"current_bitrate"` Source string `json:"source"` Quality QualityLevel `json:"quality"` MaxQuality QualityLevel `json:"max_quality"` }
type TrackStats ¶
type TrackStats struct {
// contains filtered or unexported fields
}
Source Files ¶
- bitratecontroller.go
- client.go
- clientrackaudio.go
- clientracklist.go
- clientstats.go
- clienttrack.go
- clienttrackred.go
- clienttracksimulcast.go
- clienttracksvc.go
- codec.go
- datachannel.go
- errors.go
- iext.go
- manager.go
- meta.go
- packetbuffers.go
- packetcache.go
- peerconnection.go
- relaytrack.go
- remotetrack.go
- room.go
- room_stats.go
- sfu.go
- testhelper.go
- track.go
- udpmux.go
- util.go
- util_unix.go
Directories ¶
Path | Synopsis |
---|---|
examples
|
|
pkg
|
|
pacer
modified version of pion interceptor leaky_bucket_pacer.go https://github.com/pion/interceptor/blob/master/pkg/gcc/leaky_bucket_pacer.go
|
modified version of pion interceptor leaky_bucket_pacer.go https://github.com/pion/interceptor/blob/master/pkg/gcc/leaky_bucket_pacer.go |
packetmap
Credit to Galene https://github.com/jech/galene/blob/master/packetmap/packetmap.go Package packetmap implements remapping of sequence numbers and picture ids.
|
Credit to Galene https://github.com/jech/galene/blob/master/packetmap/packetmap.go Package packetmap implements remapping of sequence numbers and picture ids. |
rtppool
this code is from pion nack interceptor https://github.com/pion/interceptor/blob/master/pkg/nack/retainable_packet.go
|
this code is from pion nack interceptor https://github.com/pion/interceptor/blob/master/pkg/nack/retainable_packet.go |