sdp

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package sdp provides SDP parsing and generation. Warning: This package does not validate sdp, it only extracts required information. Warning: This package does not produce reproducible sdp string.

Index

Constants

View Source
const (
	ConnectionRoleNone     = ""
	ConnectionRoleActive   = "active"
	ConnectionRolePassive  = "passive"
	ConnectionRoleActpass  = "actpass"
	ConnectionRoleHoldconn = "holdconn"
)
View Source
const (
	UDPProtocolName    = "udp"
	TCPProtocolName    = "tcp"
	SsltcpProtocolName = "ssltcp"
)
View Source
const (
	IceModeLite = IceMode(1)
)

Variables

View Source
var (
	ErrNoMiniSDP      = errors.New("not a mini sdp payload")
	ErrHeaderTooShort = errors.New("payload does not have enough header")
	ErrInvalidMiniSDP = errors.New("mini sdp is invalid")
	ErrExtOversize    = errors.New("ext oversize")
)
View Source
var (
	ErrSDPParseFail   = errors.New("parse line fail")
	ErrUnknownSection = errors.New("unknown section")
	ErrEmptySDP       = errors.New("empty sdp")
	ErrInvalidFID     = errors.New("invalid fid ssrc-group")
)

Functions

func IsMiniSDP

func IsMiniSDP(payload []byte) bool

func Marshal

func Marshal(sdp *SessionDescription) (string, error)

TODO not support yet

func UnmarshalMiniSDP

func UnmarshalMiniSDP(raw []byte) (*ms, error)

Types

type Candidate

type Candidate struct {
	ID             string
	Component      int
	Protocol       string
	RelayProtocol  string
	Address        string
	Priority       uint32
	Username       string
	Password       string
	Type           string
	NetworkName    string
	Generation     uint32
	Foundation     string
	RelatedAddress string
	TCPType        string
	TransportName  string
	NetworkID      uint16
	NetworkCost    uint16
	URL            string
}

type Codec

type Codec struct {
	PayloadType    uint8
	EncoderName    string
	ClockRate      int
	Channel        int // only worked for audio
	Parameters     map[string]string
	FeedbackParams []FeedbackParams
	RTX            uint8
}

type FeedbackParams

type FeedbackParams struct {
	ID     string
	Params string
}

type Fingerprint

type Fingerprint struct {
	Algorithm string
	Value     string
}

type HeaderExtension

type HeaderExtension struct {
	URI     string
	ID      uint8
	Encrypt bool
}

type IceMode

type IceMode int

type MediaDescription

type MediaDescription struct {
	MediaType        string
	MID              string
	RtcpMux          bool
	RtcpReducedSize  bool
	Direction        string
	HeaderExtensions []HeaderExtension
	Codecs           map[uint8]*Codec
	TrackID          string
	Streams          []StreamParams
	// contains filtered or unexported fields
}

type SessionDescription

type SessionDescription struct {
	ExtmapAllowMixed bool
	MsidSupported    bool
	TransportInfo    TransportInfo
	MediaDescription []*MediaDescription
}

func Unmarshal

func Unmarshal(sdp string) (*SessionDescription, error)

func (*SessionDescription) Marshal

func (s *SessionDescription) Marshal() (string, error)

func (*SessionDescription) Unmarshal

func (s *SessionDescription) Unmarshal(sdp string) error

type StreamParams

type StreamParams struct {
	SSRC  uint32
	RTX   uint32
	Cname string
	RID   string
}

type TransportInfo

type TransportInfo struct {
	IceUfrag         string
	IcePwd           string
	IceMode          IceMode
	TransportOptions []string
	ConnectionRole   string
	FingerPrint      *Fingerprint
	Candidates       []Candidate
}

Jump to

Keyboard shortcuts

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