package sdp
Import Path
github.com/pion/sdp/v3 (on go.dev)
Dependency Relation
imports 10 packages, and imported by one package
Involved Source Files
base_lexer.go
common_description.go
direction.go
extmap.go
jsep.go
marshal.go
media_description.go
Package sdp implements Session Description Protocol (SDP)
session_description.go
time_description.go
unmarshal.go
unmarshal_cache.go
util.go
Package-Level Type Names (total 23)
Address desribes a structured address token from within the "c=" field.
Address string
Range *int
TTL *int
(*Address) String() string
*Address : expvar.Var
*Address : fmt.Stringer
Attribute describes the "a=" field which represents the primary means for
extending SDP.
Key string
Value string
IsICECandidate returns true if the attribute key equals "candidate".
( Attribute) String() string
Attribute : expvar.Var
Attribute : fmt.Stringer
func NewAttribute(key, value string) Attribute
func NewPropertyAttribute(key string) Attribute
func (*ExtMap).Clone() Attribute
Bandwidth describes an optional field which denotes the proposed bandwidth
to be used by the session or media.
Bandwidth uint64
Experimental bool
Type string
( Bandwidth) String() string
Bandwidth : expvar.Var
Bandwidth : fmt.Stringer
Codec represents a codec.
ClockRate uint32
EncodingParameters string
Fmtp string
Name string
PayloadType uint8
RTCPFeedback []string
( Codec) String() string
Codec : expvar.Var
Codec : fmt.Stringer
func (*SessionDescription).GetCodecForPayloadType(payloadType uint8) (Codec, error)
func (*SessionDescription).GetPayloadTypeForCodec(wanted Codec) (uint8, error)
ConnectionInformation defines the representation for the "c=" field
containing connection data.
Address *Address
AddressType string
NetworkType string
( ConnectionInformation) String() string
ConnectionInformation : expvar.Var
ConnectionInformation : fmt.Stringer
ConnectionRole indicates which of the end points should initiate the connection establishment.
( ConnectionRole) String() string
ConnectionRole : expvar.Var
ConnectionRole : fmt.Stringer
const ConnectionRoleActive
const ConnectionRoleActpass
const ConnectionRoleHoldconn
const ConnectionRolePassive
Direction is a marker for transmission directon of an endpoint.
( Direction) String() string
Direction : expvar.Var
Direction : fmt.Stringer
func NewDirection(raw string) (Direction, error)
const DirectionInactive
const DirectionRecvOnly
const DirectionSendOnly
const DirectionSendRecv
EmailAddress describes a structured representations for the "e=" line
which specifies email contact information for the person responsible for
the conference.
( EmailAddress) String() string
EmailAddress : expvar.Var
EmailAddress : fmt.Stringer
EncryptionKey describes the "k=" which conveys encryption key information.
( EncryptionKey) String() string
EncryptionKey : expvar.Var
EncryptionKey : fmt.Stringer
ExtMap represents the activation of a single RTP header extension.
Direction Direction
ExtAttr *string
URI *url.URL
Value int
Clone converts this object to an Attribute.
Marshal creates a string from an ExtMap.
Name returns the constant name of this object.
Unmarshal creates an Extmap from a string.
*ExtMap : github.com/polarsignals/frostdb/query/logicalplan.Named
func (*MediaDescription).WithExtMap(e ExtMap) *MediaDescription
Information describes the "i=" field which provides textual information
about the session.
( Information) String() string
Information : expvar.Var
Information : fmt.Stringer
MediaDescription represents a media type.
https://tools.ietf.org/html/rfc4566#section-5.14
a=<attribute>
a=<attribute>:<value>
https://tools.ietf.org/html/rfc4566#section-5.13
b=<bwtype>:<bandwidth>
https://tools.ietf.org/html/rfc4566#section-5.8
c=<nettype> <addrtype> <connection-address>
https://tools.ietf.org/html/rfc4566#section-5.7
k=<method>
k=<method>:<encryption key>
https://tools.ietf.org/html/rfc4566#section-5.12
m=<media> <port>/<number of ports> <proto> <fmt> ...
https://tools.ietf.org/html/rfc4566#section-5.14
i=<session description>
https://tools.ietf.org/html/rfc4566#section-5.4
Attribute returns the value of an attribute and if it exists.
WithCandidate adds an ICE candidate to the media description.
Deprecated: use WithICECandidate instead.
WithCodec adds codec information to the media description.
WithExtMap adds an extmap to the media description.
WithFingerprint adds a fingerprint to the media description.
WithICECredentials adds ICE credentials to the media description.
WithMediaSource adds media source information to the media description.
WithPropertyAttribute adds a property attribute 'a=key' to the media description.
WithTransportCCExtMap adds an extmap to the media description.
WithValueAttribute adds a value attribute 'a=key:value' to the media description.
func NewJSEPMediaDescription(codecType string, _ []string) *MediaDescription
func (*MediaDescription).WithCandidate(value string) *MediaDescription
func (*MediaDescription).WithCodec(payloadType uint8, name string, clockrate uint32, channels uint16, fmtp string) *MediaDescription
func (*MediaDescription).WithExtMap(e ExtMap) *MediaDescription
func (*MediaDescription).WithFingerprint(algorithm, value string) *MediaDescription
func (*MediaDescription).WithICECredentials(username, password string) *MediaDescription
func (*MediaDescription).WithMediaSource(ssrc uint32, cname, streamLabel, label string) *MediaDescription
func (*MediaDescription).WithPropertyAttribute(key string) *MediaDescription
func (*MediaDescription).WithTransportCCExtMap() *MediaDescription
func (*MediaDescription).WithValueAttribute(key, value string) *MediaDescription
func (*SessionDescription).WithMedia(md *MediaDescription) *SessionDescription
MediaName describes the "m=" field storage structure.
Formats []string
Media string
Port RangedPort
Protos []string
( MediaName) String() string
MediaName : expvar.Var
MediaName : fmt.Stringer
Origin defines the structure for the "o=" field which provides the
originator of the session plus a session identifier and version number.
AddressType string
NetworkType string
SessionID uint64
SessionVersion uint64
UnicastAddress string
Username string
( Origin) String() string
Origin : expvar.Var
Origin : fmt.Stringer
PhoneNumber describes a structured representations for the "p=" line
specify phone contact information for the person responsible for the
conference.
( PhoneNumber) String() string
PhoneNumber : expvar.Var
PhoneNumber : fmt.Stringer
RangedPort supports special format for the media field "m=" port value. If
it may be necessary to specify multiple transport ports, the protocol allows
to write it as: <port>/<number of ports> where number of ports is a an
offsetting range.
Range *int
Value int
(*RangedPort) String() string
*RangedPort : expvar.Var
*RangedPort : fmt.Stringer
RepeatTime describes the "r=" fields of the session description which
represents the intervals and durations for repeated scheduled sessions.
Duration int64
Interval int64
Offsets []int64
( RepeatTime) String() string
RepeatTime : expvar.Var
RepeatTime : fmt.Stringer
SessionDescription is a a well-defined format for conveying sufficient
information to discover and participate in a multimedia session.
a=<attribute>
a=<attribute>:<value>
https://tools.ietf.org/html/rfc4566#section-5.13
b=<bwtype>:<bandwidth>
https://tools.ietf.org/html/rfc4566#section-5.8
c=<nettype> <addrtype> <connection-address>
https://tools.ietf.org/html/rfc4566#section-5.7
e=<email-address>
https://tools.ietf.org/html/rfc4566#section-5.6
k=<method>
k=<method>:<encryption key>
https://tools.ietf.org/html/rfc4566#section-5.12
https://tools.ietf.org/html/rfc4566#section-5.14
o=<username> <sess-id> <sess-version> <nettype> <addrtype> <unicast-address>
https://tools.ietf.org/html/rfc4566#section-5.2
p=<phone-number>
https://tools.ietf.org/html/rfc4566#section-5.6
i=<session description>
https://tools.ietf.org/html/rfc4566#section-5.4
s=<session name>
https://tools.ietf.org/html/rfc4566#section-5.3
https://tools.ietf.org/html/rfc4566#section-5.9
https://tools.ietf.org/html/rfc4566#section-5.10
z=<adjustment time> <offset> <adjustment time> <offset> ...
https://tools.ietf.org/html/rfc4566#section-5.11
u=<uri>
https://tools.ietf.org/html/rfc4566#section-5.5
v=0
https://tools.ietf.org/html/rfc4566#section-5.1
Attribute returns the value of an attribute and if it exists.
GetCodecForPayloadType scans the SessionDescription for the given payload type and returns the codec.
GetPayloadTypeForCodec scans the SessionDescription for a codec that matches the provided codec
as closely as possible and returns its payload type.
Marshal takes a SDP struct to text
https://tools.ietf.org/html/rfc4566#section-5
Session description
v= (protocol version)
o= (originator and session identifier)
s= (session name)
i=* (session information)
u=* (URI of description)
e=* (email address)
p=* (phone number)
c=* (connection information -- not required if included in
all media)
b=* (zero or more bandwidth information lines)
One or more time descriptions ("t=" and "r=" lines; see below)
z=* (time zone adjustments)
k=* (encryption key)
a=* (zero or more session attribute lines)
Zero or more media descriptions
Time description
t= (time the session is active)
r=* (zero or more repeat times)
Media description, if present
m= (media name and transport address)
i=* (media title)
c=* (connection information -- optional if included at
session level)
b=* (zero or more bandwidth information lines)
k=* (encryption key)
a=* (zero or more media attribute lines)
MarshalSize returns the size of the SessionDescription once marshaled.
Unmarshal converts the value into a []byte and then calls UnmarshalString.
Callers should use the more performant UnmarshalString.
UnmarshalString is the primary function that deserializes the session description
message and stores it inside of a structured SessionDescription object.
The States Transition Table describes the computation flow between functions
(namely s1, s2, s3, ...) for a parsing procedure that complies with the
specifications laid out by the rfc4566#section-5 as well as by JavaScript
Session Establishment Protocol draft. Links:
https://tools.ietf.org/html/rfc4566#section-5
https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-24
https://tools.ietf.org/html/rfc4566#section-5
Session description
v= (protocol version)
o= (originator and session identifier)
s= (session name)
i=* (session information)
u=* (URI of description)
e=* (email address)
p=* (phone number)
c=* (connection information -- not required if included in
all media)
b=* (zero or more bandwidth information lines)
One or more time descriptions ("t=" and "r=" lines; see below)
z=* (time zone adjustments)
k=* (encryption key)
a=* (zero or more session attribute lines)
Zero or more media descriptions
Time description
t= (time the session is active)
r=* (zero or more repeat times)
Media description, if present
m= (media name and transport address)
i=* (media title)
c=* (connection information -- optional if included at
session level)
b=* (zero or more bandwidth information lines)
k=* (encryption key)
a=* (zero or more media attribute lines)
In order to generate the following state table and draw subsequent
deterministic finite-state automota ("DFA") the following regex was used to
derive the DFA:
vosi?u?e?p?c?b*(tr*)+z?k?a*(mi?c?b*k?a*)*
possible place and state to exit:
** * * * ** * * * *
99 1 1 1 11 1 1 1 1
3 1 1 26 5 5 4 4
Please pay close attention to the `k`, and `a` parsing states. In the table
below in order to distinguish between the states belonging to the media
description as opposed to the session description, the states are marked
with an asterisk ("a*", "k*").
+--------+----+-------+----+-----+----+-----+---+----+----+---+---+-----+---+---+----+---+----+
| STATES | a* | a*,k* | a | a,k | b | b,c | e | i | m | o | p | r,t | s | t | u | v | z |
+--------+----+-------+----+-----+----+-----+---+----+----+---+---+-----+---+---+----+---+----+
| s1 | | | | | | | | | | | | | | | | 2 | |
| s2 | | | | | | | | | | 3 | | | | | | | |
| s3 | | | | | | | | | | | | | 4 | | | | |
| s4 | | | | | | 5 | 6 | 7 | | | 8 | | | 9 | 10 | | |
| s5 | | | | | 5 | | | | | | | | | 9 | | | |
| s6 | | | | | | 5 | | | | | 8 | | | 9 | | | |
| s7 | | | | | | 5 | 6 | | | | 8 | | | 9 | 10 | | |
| s8 | | | | | | 5 | | | | | | | | 9 | | | |
| s9 | | | | 11 | | | | | 12 | | | 9 | | | | | 13 |
| s10 | | | | | | 5 | 6 | | | | 8 | | | 9 | | | |
| s11 | | | 11 | | | | | | 12 | | | | | | | | |
| s12 | | 14 | | | | 15 | | 16 | 12 | | | | | | | | |
| s13 | | | | 11 | | | | | 12 | | | | | | | | |
| s14 | 14 | | | | | | | | 12 | | | | | | | | |
| s15 | | 14 | | | 15 | | | | 12 | | | | | | | | |
| s16 | | 14 | | | | 15 | | | 12 | | | | | | | | |
+--------+----+-------+----+-----+----+-----+---+----+----+---+---+-----+---+---+----+---+----+ .
WithFingerprint adds a fingerprint to the session description.
WithICETrickleAdvertised advertises ICE trickle support in the session description.
See https://datatracker.ietf.org/doc/html/rfc9429#section-5.2.1
WithMedia adds a media description to the session description.
WithPropertyAttribute adds a property attribute 'a=key' to the session description.
WithValueAttribute adds a value attribute 'a=key:value' to the session description.
*SessionDescription : github.com/pion/rtcp.PacketStatusChunk
*SessionDescription : github.com/gogo/protobuf/proto.Marshaler
*SessionDescription : github.com/gogo/protobuf/proto.Unmarshaler
*SessionDescription : github.com/golang/protobuf/proto.Marshaler
*SessionDescription : github.com/golang/protobuf/proto.Unmarshaler
func NewJSEPSessionDescription(identity bool) (*SessionDescription, error)
func (*SessionDescription).WithFingerprint(algorithm, value string) *SessionDescription
func (*SessionDescription).WithICETrickleAdvertised() *SessionDescription
func (*SessionDescription).WithMedia(md *MediaDescription) *SessionDescription
func (*SessionDescription).WithPropertyAttribute(key string) *SessionDescription
func (*SessionDescription).WithValueAttribute(key, value string) *SessionDescription
func github.com/pion/webrtc/v4.(*SessionDescription).Unmarshal() (*SessionDescription, error)
SessionName describes a structured representations for the "s=" field
and is the textual session name.
( SessionName) String() string
SessionName : expvar.Var
SessionName : fmt.Stringer
TimeDescription describes "t=", "r=" fields of the session description
which are used to specify the start and stop times for a session as well as
repeat intervals and durations for the scheduled session.
r=<repeat interval> <active duration> <offsets from start-time>
https://tools.ietf.org/html/rfc4566#section-5.10
t=<start-time> <stop-time>
https://tools.ietf.org/html/rfc4566#section-5.9
TimeZone defines the structured object for "z=" line which describes
repeated sessions scheduling.
AdjustmentTime uint64
Offset int64
( TimeZone) String() string
TimeZone : expvar.Var
TimeZone : fmt.Stringer
Package-Level Functions (total 5)
NewAttribute constructs a new attribute.
NewDirection defines a procedure for creating a new direction from a raw
string.
NewJSEPMediaDescription creates a new MediaName with
some settings that are required by the JSEP spec.
NewJSEPSessionDescription creates a new SessionDescription with
some settings that are required by the JSEP spec.
Note: Since v2.4.0, session ID has been fixed to use crypto random according to
JSEP spec, so that NewJSEPSessionDescription now returns error as a second
return value.
NewPropertyAttribute constructs a new attribute.
Package-Level Constants (total 44)
Default ext values.
Constants for SDP attributes used in JSEP.
Constants for SDP attributes used in JSEP.
Constants for SDP attributes used in JSEP.
Constants for SDP attributes used in JSEP.
Constants for SDP attributes used in JSEP.
Constants for SDP attributes used in JSEP.
Constants for SDP attributes used in JSEP.
Constants for SDP attributes used in JSEP.
Constants for SDP attributes used in JSEP.
Constants for SDP attributes used in JSEP.
Constants for SDP attributes used in JSEP.
Constants for SDP attributes used in JSEP.
Constants for SDP attributes used in JSEP.
Constants for SDP attributes used in JSEP.
Constants for SDP attributes used in JSEP.
Constants for SDP attributes used in JSEP.
Constants for SDP attributes used in JSEP.
Constants for SDP attributes used in JSEP.
Constants for SDP attributes used in JSEP.
Constants for SDP attributes used in JSEP.
Default ext values.
ConnectionRoleActive indicates the endpoint will initiate an outgoing connection.
ConnectionRoleActpass indicates the endpoint is willing to accept an incoming connection or
to initiate an outgoing connection.
ConnectionRoleHoldconn indicates the endpoint does not want the connection to be established for the time being.
ConnectionRolePassive indicates the endpoint will accept an incoming connection.
Default ext values.
Default ext values.
Default ext values.
Default ext values.
DirectionInactive is for no communication.
DirectionRecvOnly is for incoming communication.
DirectionSendOnly is for outgoing communication.
DirectionSendRecv is for bidirectional communication.
Constants for extmap key.
Default ext values.
Default ext values.
Default ext values.
Constants for semantic tokens used in JSEP.
Constants for semantic tokens used in JSEP.
Constants for semantic tokens used in JSEP.
Constants for semantic tokens used in JSEP.
Default ext values.
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |