Documentation ¶
Index ¶
- Variables
- func New(u url.URL, room string) router.MiddlewareFunc
- type AudioEngine
- type Config
- type Join
- type JoinConfig
- type Message
- type Negotiation
- type Peer
- type PeerConn
- func (c PeerConn) AddIceCandidate(candidate webrtc.ICECandidateInit) error
- func (c PeerConn) Answer() (webrtc.SessionDescription, error)
- func (c PeerConn) GetOffer() (webrtc.SessionDescription, error)
- func (c PeerConn) Offer(offer webrtc.SessionDescription) error
- func (c PeerConn) SetAnswer(answer webrtc.SessionDescription) error
- type RTCConnection
- func (r *RTCConnection) GetOffer() (webrtc.SessionDescription, error)
- func (r *RTCConnection) OnOffer(offer webrtc.SessionDescription) (webrtc.SessionDescription, error)
- func (r *RTCConnection) OnTrickle(candidate webrtc.ICECandidateInit, target int) error
- func (r *RTCConnection) SetAnswer(answer webrtc.SessionDescription) error
- type RTCConnectionParams
- type SocketConnection
- func (s *SocketConnection) Connect() error
- func (s *SocketConnection) Join(room string, offer webrtc.SessionDescription) error
- func (s *SocketConnection) SendAnswer(answer webrtc.SessionDescription) error
- func (s *SocketConnection) SendTrickle(candidate *webrtc.ICECandidate, target int) error
- func (s *SocketConnection) SetOnAnswer(onAnswer func(ans webrtc.SessionDescription) error)
- func (s *SocketConnection) SetOnOffer(onOffer func(offer webrtc.SessionDescription) error)
- func (s *SocketConnection) SetOnTrickle(onTrickle func(candidate webrtc.ICECandidateInit, target int) error)
- func (s *SocketConnection) WaitForDone()
- type Trickle
Constants ¶
This section is empty.
Variables ¶
View Source
var Logger = logr.New()
Functions ¶
Types ¶
type AudioEngine ¶
type AudioEngine struct {
// contains filtered or unexported fields
}
AudioEngine is used to convert RTP Opus packets to raw PCM audio to be sent to Whisper and to convert raw PCM audio from Coqui back to RTP Opus packets to be sent back over WebRTC
func NewAudioEngine ¶
func NewAudioEngine(capture chan<- *router.CapturedSample) (*AudioEngine, error)
func (*AudioEngine) Encode ¶
func (a *AudioEngine) Encode(pcm []float32, inputChannelCount, inputSampleRate int) error
Encode takes in raw f32le pcm, encodes it into opus RTP packets and sends those over the rtpOut chan
func (*AudioEngine) MediaOut ¶
func (a *AudioEngine) MediaOut() <-chan media.Sample
func (*AudioEngine) RtpIn ¶
func (a *AudioEngine) RtpIn() chan<- *rtp.Packet
func (*AudioEngine) Start ¶
func (a *AudioEngine) Start()
type Join ¶
type Join struct { SID string `json:"sid"` UID string `json:"uid"` Offer webrtc.SessionDescription `json:"offer,omitempty"` Config JoinConfig `json:"config,omitempty"` }
TODO move these to core Join message sent when initializing a peer connection
type JoinConfig ¶
type JoinConfig struct { // If true the peer will not be allowed to publish tracks to SessionLocal. NoPublish bool // If true the peer will not be allowed to subscribe to other peers in SessionLocal. NoSubscribe bool // If true the peer will not automatically subscribe all tracks, // and then the peer can use peer.Subscriber().AddDownTrack/RemoveDownTrack // to customize the subscrbe stream combination as needed. // this parameter depends on NoSubscribe=false. NoAutoSubscribe bool }
JoinConfig allow adding more control to the peers joining a SessionLocal.
type Message ¶
type Message[T Join | Negotiation | Trickle] struct { Method string `json:"method"` Params T `json:"params"` }
type Negotiation ¶
type Negotiation struct {
Desc webrtc.SessionDescription `json:"desc"`
}
Negotiation message sent when renegotiating the peer connection
type PeerConn ¶
type PeerConn struct {
// contains filtered or unexported fields
}
func NewPeerConn ¶
func NewPeerConn(onICECandidate func(candidate *webrtc.ICECandidate)) PeerConn
func (PeerConn) AddIceCandidate ¶
type RTCConnection ¶
type RTCConnection struct {
// contains filtered or unexported fields
}
func NewRTCConnection ¶
func NewRTCConnection(params RTCConnectionParams) (*RTCConnection, error)
FIXME if documentStream AND mediaIn are not provided this will blow up
func (*RTCConnection) GetOffer ¶
func (r *RTCConnection) GetOffer() (webrtc.SessionDescription, error)
func (*RTCConnection) OnOffer ¶
func (r *RTCConnection) OnOffer(offer webrtc.SessionDescription) (webrtc.SessionDescription, error)
func (*RTCConnection) OnTrickle ¶
func (r *RTCConnection) OnTrickle(candidate webrtc.ICECandidateInit, target int) error
func (*RTCConnection) SetAnswer ¶
func (r *RTCConnection) SetAnswer(answer webrtc.SessionDescription) error
type RTCConnectionParams ¶
type RTCConnectionParams struct {
// contains filtered or unexported fields
}
type SocketConnection ¶
type SocketConnection struct {
// contains filtered or unexported fields
}
func NewSocketConnection ¶
func NewSocketConnection(url url.URL) *SocketConnection
func (*SocketConnection) Connect ¶
func (s *SocketConnection) Connect() error
func (*SocketConnection) Join ¶
func (s *SocketConnection) Join(room string, offer webrtc.SessionDescription) error
func (*SocketConnection) SendAnswer ¶
func (s *SocketConnection) SendAnswer(answer webrtc.SessionDescription) error
func (*SocketConnection) SendTrickle ¶
func (s *SocketConnection) SendTrickle(candidate *webrtc.ICECandidate, target int) error
func (*SocketConnection) SetOnAnswer ¶
func (s *SocketConnection) SetOnAnswer(onAnswer func(ans webrtc.SessionDescription) error)
func (*SocketConnection) SetOnOffer ¶
func (s *SocketConnection) SetOnOffer(onOffer func(offer webrtc.SessionDescription) error)
func (*SocketConnection) SetOnTrickle ¶
func (s *SocketConnection) SetOnTrickle(onTrickle func(candidate webrtc.ICECandidateInit, target int) error)
func (*SocketConnection) WaitForDone ¶
func (s *SocketConnection) WaitForDone()
Source Files ¶
Click to show internal directories.
Click to hide internal directories.