webrtc

package
v0.0.0-...-769c010 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: MIT Imports: 21 Imported by: 0

README

StateChange

  1. offer = pc.CreateOffer()
  2. pc.SetLocalDescription(offer)
  3. OnICEGatheringStateChange: gathering
  4. OnSignalingStateChange: have-local-offer *. OnICEGatheringStateChange: complete
  5. pc.SetRemoteDescription(answer)
  6. OnSignalingStateChange: stable
  7. OnICEConnectionStateChange: checking
  8. OnICEConnectionStateChange: connected

Documentation

Index

Constants

View Source
const PriorityHostTCPPassive uint32 = 0x001F_FFFF |
	99<<24 |

	4<<21 // tcp passive
View Source
const PriorityHostUDP uint32 = 0x001F_FFFF |
	126<<24 |

	7<<21 // udp
View Source
const ReceiveMTU = 1472

ReceiveMTU = Ethernet MTU (1500) - IP Header (20) - UDP Header (8) https://ffmpeg.org/ffmpeg-all.html#Muxer

Variables

This section is empty.

Functions

func CandidateHostPriority

func CandidateHostPriority(network string, index int) uint32

CandidateHostPriority (lower indexes has a higher priority)

func CandidateICE

func CandidateICE(network, host, port string, priority uint32) string

func GetCachedPublicIP

func GetCachedPublicIP() (net.IP, error)

func GetPublicIP

func GetPublicIP() (net.IP, error)

GetPublicIP example from https://github.com/pion/stun

func IsIP

func IsIP(host string) bool

func LookupIP

func LookupIP(address string) (string, error)

func MimeType

func MimeType(codec *core.Codec) string

func NewAPI

func NewAPI() (*webrtc.API, error)

func NewCandidate

func NewCandidate(network, address string) (string, error)

func NewServerAPI

func NewServerAPI(network, address string, filters *Filters) (*webrtc.API, error)

func RegisterDefaultCodecs

func RegisterDefaultCodecs(m *webrtc.MediaEngine) error

func SkipNonMediaCodecs

func SkipNonMediaCodecs(input []*core.Codec) (output []*core.Codec)

func UnmarshalICEServers

func UnmarshalICEServers(b []byte) ([]webrtc.ICEServer, error)

func UnmarshalMedias

func UnmarshalMedias(descriptions []*sdp.MediaDescription) (medias []*core.Media)

func WithResampling

func WithResampling(medias []*core.Media) []*core.Media

WithResampling - will add for consumer: PCMA/0, PCMU/0, PCM/0, PCML/0 so it can add resampling for PCMA/PCMU and repack for PCM/PCML

Types

type Conn

type Conn struct {
	core.Connection
	core.Listener

	Mode core.Mode `json:"mode"`
	// contains filtered or unexported fields
}

func NewConn

func NewConn(pc *webrtc.PeerConnection) *Conn

func (*Conn) AddCandidate

func (c *Conn) AddCandidate(candidate string) error

func (*Conn) AddTrack

func (c *Conn) AddTrack(media *core.Media, codec *core.Codec, track *core.Receiver) error

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) CreateCompleteOffer

func (c *Conn) CreateCompleteOffer(medias []*core.Media) (string, error)

func (*Conn) CreateOffer

func (c *Conn) CreateOffer(medias []*core.Media) (string, error)

func (*Conn) GetAnswer

func (c *Conn) GetAnswer() (answer string, err error)

func (*Conn) GetCompleteAnswer

func (c *Conn) GetCompleteAnswer(candidates []string, filter func(*webrtc.ICECandidate) bool) (string, error)

GetCompleteAnswer - get SDP answer with candidates inside

func (*Conn) GetMedias

func (c *Conn) GetMedias() []*core.Media

func (*Conn) GetTrack

func (c *Conn) GetTrack(media *core.Media, codec *core.Codec) (*core.Receiver, error)

func (*Conn) MarshalJSON

func (c *Conn) MarshalJSON() ([]byte, error)

func (*Conn) SetAnswer

func (c *Conn) SetAnswer(answer string) (err error)

func (*Conn) SetOffer

func (c *Conn) SetOffer(offer string) (err error)

func (*Conn) Start

func (c *Conn) Start() error

type Filters

type Filters struct {
	Candidates []string `yaml:"candidates"`
	Interfaces []string `yaml:"interfaces"`
	IPs        []string `yaml:"ips"`
	Networks   []string `yaml:"networks"`
	UDPPorts   []uint16 `yaml:"udp_ports"`
}

type Track

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

func NewTrack

func NewTrack(kind string) *Track

func (*Track) Bind

func (t *Track) Bind(context webrtc.TrackLocalContext) (webrtc.RTPCodecParameters, error)

func (*Track) ID

func (t *Track) ID() string

func (*Track) Kind

func (t *Track) Kind() webrtc.RTPCodecType

func (*Track) RID

func (t *Track) RID() string

func (*Track) StreamID

func (t *Track) StreamID() string

func (*Track) Unbind

func (t *Track) Unbind(context webrtc.TrackLocalContext) error

func (*Track) WriteRTP

func (t *Track) WriteRTP(payloadType uint8, packet *rtp.Packet) (err error)

Jump to

Keyboard shortcuts

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