gortc

package
v0.0.0-...-231556c Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RolePublisher  = 0
	RoleSubscriber = 1
)

Variables

View Source
var (
	ErrSpatialNotSupported = errors.New("current track does not support simulcast/SVC")
	ErrSpatialLayerBusy    = errors.New("a spatial layer change is in progress, try latter")
)

Functions

This section is empty.

Types

type Candidates

type Candidates struct {
	IceLite    bool     `mapstructure:"icelite"`
	NAT1To1IPs []string `mapstructure:"nat1to1"`
}

type ICECandidateInit

type ICECandidateInit webrtc.ICECandidateInit

func (*ICECandidateInit) ToJSON

func (ice *ICECandidateInit) ToJSON() string

type ICEServerConfig

type ICEServerConfig struct {
	URLs       []string `mapstructure:"urls"`
	Username   string   `mapstructure:"username"`
	Credential string   `mapstructure:"credential"`
}

ICEServerConfig defines parameters for ice servers

type Publisher

type Publisher struct {
	OnIceCandidate func(*webrtc.ICECandidateInit, int)
	// contains filtered or unexported fields
}

func NewPublisher

func NewPublisher(ctx context.Context, id string, cfg WebRTCTransportConfig, logger *logrus.Entry) (*Publisher, error)

func (*Publisher) AddICECandidate

func (p *Publisher) AddICECandidate(candidate webrtc.ICECandidateInit) error

func (*Publisher) Answer

func (p *Publisher) Answer(sdp webrtc.SessionDescription) (*webrtc.SessionDescription, error)

func (*Publisher) Close

func (p *Publisher) Close()

func (*Publisher) GetUpTrack

func (p *Publisher) GetUpTrack(trackId string) *UpTrack

func (*Publisher) Logger

func (p *Publisher) Logger() *logrus.Entry

func (*Publisher) OnUpTrack

func (p *Publisher) OnUpTrack(fn func(track forwarder.IFrameSource, layer int8))

IPublisher impl begin

type RetransmitPacketMsg

type RetransmitPacketMsg struct {
	Dest    forwarder.IFrameDestination
	Packets []packetMeta
}

type SessionDescription

type SessionDescription webrtc.SessionDescription

type SimulcastConfig

type SimulcastConfig struct {
	BestQualityFirst    bool `mapstructure:"bestqualityfirst"`
	EnableTemporalLayer bool `mapstructure:"enabletemporallayer"`
}

type Subscriber

type Subscriber struct {
	sync.Mutex
	OnOffer                    func(offer *webrtc.SessionDescription)
	OnIceCandidate             func(*webrtc.ICECandidateInit, int)
	OnICEConnectionStateChange func(webrtc.ICEConnectionState)
	// contains filtered or unexported fields
}

func NewSubscriber

func NewSubscriber(ctx context.Context, id string, c WebRTCTransportConfig, logger *logrus.Entry) (*Subscriber, error)

func (*Subscriber) AddICECandidate

func (s *Subscriber) AddICECandidate(candidate webrtc.ICECandidateInit) error

func (*Subscriber) Close

func (s *Subscriber) Close()

func (*Subscriber) CreateOffer

func (s *Subscriber) CreateOffer() (webrtc.SessionDescription, error)

func (*Subscriber) Logger

func (s *Subscriber) Logger() *logrus.Entry

func (*Subscriber) NegotiateTracks

func (s *Subscriber) NegotiateTracks()

func (*Subscriber) OnDownTrack

func (s *Subscriber) OnDownTrack(fn func(track forwarder.IDownTrack))

func (*Subscriber) OnNegotiateTracks

func (s *Subscriber) OnNegotiateTracks(f func())

func (*Subscriber) SetRemoteDescription

func (s *Subscriber) SetRemoteDescription(sdp webrtc.SessionDescription) error

SetRemoteDescription when receiving an answer from remote

type UpTrack

type UpTrack struct {
	forwarder.FrameSource
	// contains filtered or unexported fields
}

func NewUpTrack

func NewUpTrack(buff *buffer.Buffer,
	remoteTrack *webrtc.TrackRemote,
	receiver *webrtc.RTPReceiver,
	maxBitRate uint64,
	logger *logrus.Entry) *UpTrack

func (*UpTrack) Close

func (up *UpTrack) Close()

func (*UpTrack) GetCodecType

func (up *UpTrack) GetCodecType() forwarder.FrameFormat

func (*UpTrack) GetFrameKind

func (up *UpTrack) GetFrameKind() forwarder.FrameKind

func (*UpTrack) GetPacketType

func (up *UpTrack) GetPacketType() forwarder.PacketType

func (*UpTrack) Layer

func (up *UpTrack) Layer() int8

func (*UpTrack) SendRTCP

func (up *UpTrack) SendRTCP(p []rtcp.Packet)

func (*UpTrack) SetRTCPCh

func (up *UpTrack) SetRTCPCh(ch chan []rtcp.Packet)

func (*UpTrack) WriteFeedback

func (up *UpTrack) WriteFeedback(fb *forwarder.FeedbackMsg)

type WebRTC

type WebRTC struct {
	gomodule.DefaultModule
	// contains filtered or unexported fields
}

func WebRTCModule

func WebRTCModule() *WebRTC

func (*WebRTC) ConfigChanged

func (rtc *WebRTC) ConfigChanged()

func (*WebRTC) InitCommand

func (rtc *WebRTC) InitCommand() ([]*cobra.Command, error)

func (*WebRTC) InitModule

func (rtc *WebRTC) InitModule(_ context.Context, _ *gomodule.Manager) (interface{}, error)

func (*WebRTC) ModuleRun

func (rtc *WebRTC) ModuleRun()

func (*WebRTC) NewPublisher

func (rtc *WebRTC) NewPublisher(ctx context.Context, id string, logger *logrus.Entry) (forwarder.IPublisher, error)

func (*WebRTC) NewSubscriber

func (rtc *WebRTC) NewSubscriber(ctx context.Context, id string, logger *logrus.Entry) (forwarder.ISubscriber, error)

func (*WebRTC) WebRTCConfig

func (rtc *WebRTC) WebRTCConfig() WebRTCTransportConfig

type WebRTCConfig

type WebRTCConfig struct {
	ICESinglePort   int                  `mapstructure:"singleport"`
	ICEPortRange    []uint16             `mapstructure:"portrange"`
	ICEServers      []ICEServerConfig    `mapstructure:"iceserver"`
	Candidates      Candidates           `mapstructure:"candidates"`
	SDPSemantics    string               `mapstructure:"sdpsemantics"`
	MDNS            bool                 `mapstructure:"mdns"`
	Timeouts        WebRTCTimeoutsConfig `mapstructure:"timeouts"`
	TrackingPackets int                  `mapstructure:"trackingPackets"`
	MaxBitRate      int                  `mapstructure:"maxBitRate"`
}

WebRTCConfig defines parameters for ice

func (*WebRTCConfig) Compare

func (wc *WebRTCConfig) Compare(other *WebRTCConfig) bool

type WebRTCTimeoutsConfig

type WebRTCTimeoutsConfig struct {
	ICEDisconnectedTimeout int `mapstructure:"disconnected"`
	ICEFailedTimeout       int `mapstructure:"failed"`
	ICEKeepaliveInterval   int `mapstructure:"keepalive"`
}

type WebRTCTransportConfig

type WebRTCTransportConfig struct {
	Configuration   webrtc.Configuration
	Setting         webrtc.SettingEngine
	MaxBitRate      int
	TrackingPackets int
}

WebRTCTransportConfig represents Configuration options

Jump to

Keyboard shortcuts

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