sdp

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCodecForPayloadType

func GetCodecForPayloadType(payloadType uint8, sd *SessionDescription) (ok bool, codec string)

GetCodecForPayloadType scans the SessionDescription for the given payloadType and returns the codec

Types

type MediaDescription

type MediaDescription struct {
	// MediaName is m=<media> <port> <proto> <fmt>
	// <media> is the media type
	// <port> is the transport port to which the media stream is sent
	// <proto> is the transport protocol
	// <fmt> is a media format description
	// https://tools.ietf.org/html/rfc4566#section-5.13
	MediaName string

	// SessionInformation field provides textual information about the session.  There
	// MUST be at most one session-level SessionInformation field per session description,
	// and at most one SessionInformation field per media
	// https://tools.ietf.org/html/rfc4566#section-5.4
	MediaInformation string

	// ConnectionData a session description MUST contain either at least one ConnectionData field in
	// each media description or a single ConnectionData field at the session level.
	// https://tools.ietf.org/html/rfc4566#section-5.7
	ConnectionData string

	// Bandwidth field denotes the proposed bandwidth to be used by the
	// session or media
	// b=<bwtype>:<bandwidth>
	// https://tools.ietf.org/html/rfc4566#section-5.8
	Bandwidth []string

	// EncryptionKeys if for when the SessionDescription is transported over a secure and trusted channel,
	// the Session Description Protocol MAY be used to convey encryption keys
	// https://tools.ietf.org/html/rfc4566#section-5.11
	EncryptionKeys []string

	// Attributes are the primary means for extending SDP.  Attributes may
	// be defined to be used as "session-level" attributes, "media-level"
	// attributes, or both.
	// https://tools.ietf.org/html/rfc4566#section-5.12
	Attributes []string
}

MediaDescription represents a media type. Currently defined media are "audio", "video", "text", "application", and "message", although this list may be extended in the future https://tools.ietf.org/html/rfc4566#section-5.14

type SessionBuilder

type SessionBuilder struct {
	IceUsername, IcePassword, Fingerprint string

	Candidates []string

	Tracks []*SessionBuilderTrack
}

SessionBuilder provides an easy way to build an SDP for an RTCPeerConnection

type SessionBuilderTrack

type SessionBuilderTrack struct {
	SSRC    uint32
	IsAudio bool
}

SessionBuilderTrack represents a single track in a SessionBuilder

type SessionDescription

type SessionDescription struct {
	// ProtocolVersion gives the version of the Session Description Protocol
	// https://tools.ietf.org/html/rfc4566#section-5.1
	ProtocolVersion int

	// Origin gives the originator of the session in the form of
	// o=<username> <sess-id> <sess-version> <nettype> <addrtype> <unicast-address>
	// https://tools.ietf.org/html/rfc4566#section-5.2
	Origin string

	// SessionName is the textual session name. There MUST be one and only one
	// only one "s=" field per session description
	// https://tools.ietf.org/html/rfc4566#section-5.3
	SessionName string

	// SessionInformation field provides textual information about the session.  There
	// MUST be at most one session-level SessionInformation field per session description,
	// and at most one SessionInformation field per media
	// https://tools.ietf.org/html/rfc4566#section-5.4
	SessionInformation string

	// URI is a pointer to additional information about the
	// session.  This field is OPTIONAL, but if it is present it MUST be
	// specified before the first media field.  No more than one URI field
	// is allowed per session description.
	// https://tools.ietf.org/html/rfc4566#section-5.5
	URI string

	// EmailAddress specifies the email for the person responsible for the conference
	// https://tools.ietf.org/html/rfc4566#section-5.6
	EmailAddress string

	// PhoneNumber specifies the phone number for the person responsible for the conference
	// https://tools.ietf.org/html/rfc4566#section-5.6
	PhoneNumber string

	// ConnectionData a session description MUST contain either at least one ConnectionData field in
	// each media description or a single ConnectionData field at the session level.
	// https://tools.ietf.org/html/rfc4566#section-5.7
	ConnectionData string

	// Bandwidth field denotes the proposed bandwidth to be used by the
	// session or media
	// b=<bwtype>:<bandwidth>
	// https://tools.ietf.org/html/rfc4566#section-5.8
	Bandwidth []string

	// Timing lines specify the start and stop times for a session.
	// t=<start-time> <stop-time>
	// https://tools.ietf.org/html/rfc4566#section-5.9
	Timing []string

	// RepeatTimes specify repeat times for a session
	// r=<repeat interval> <active duration> <offsets from start-time>
	// https://tools.ietf.org/html/rfc4566#section-5.10
	RepeatTimes []string

	// TimeZones schedule a repeated session that spans a change from daylight
	// z=<adjustment time> <offset> <adjustment time> <offset>
	// https://tools.ietf.org/html/rfc4566#section-5.11
	TimeZones []string

	// EncryptionKeys if for when the SessionDescription is transported over a secure and trusted channel,
	// the Session Description Protocol MAY be used to convey encryption keys
	// https://tools.ietf.org/html/rfc4566#section-5.11
	EncryptionKeys []string

	// Attributes are the primary means for extending SDP.  Attributes may
	// be defined to be used as "session-level" attributes, "media-level"
	// attributes, or both.
	// https://tools.ietf.org/html/rfc4566#section-5.12
	Attributes []string

	// MediaDescriptions A session description may contain a number of media descriptions.
	// Each media description starts with an "m=" field and is terminated by
	// either the next "m=" field or by the end of the session description.
	// https://tools.ietf.org/html/rfc4566#section-5.13
	MediaDescriptions []*MediaDescription
}

SessionDescription is a a well-defined format for conveying sufficient information to discover and participate in a multimedia session.

func BaseSessionDescription

func BaseSessionDescription(b *SessionBuilder) *SessionDescription

BaseSessionDescription generates a default SDP response that is ice-lite, initiates the DTLS session and supports VP8, VP9 and Opus

func (*SessionDescription) Marshal

func (s *SessionDescription) Marshal() (raw string)

Marshal creates a raw string from a SessionDescription Some lines in each description are REQUIRED and some are OPTIONAL, but all MUST appear in exactly the order given here (the fixed order greatly enhances error detection and allows for a simple parser). OPTIONAL items are marked with a "*". 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) t=* (One or more time descriptions) r=* (One or more repeat descriptions) z=* (time zone adjustments) k=* (encryption key) a=* (zero or more session attribute lines) Zero or more media descriptions https://tools.ietf.org/html/rfc4566#section-5

func (*SessionDescription) Reset

func (s *SessionDescription) Reset()

Reset cleans the SessionDescription, and sets all fields back to their default values

func (*SessionDescription) Unmarshal

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

Unmarshal populates a SessionDescription from a raw string

Some lines in each description are REQUIRED and some are OPTIONAL, but all MUST appear in exactly the order given here (the fixed order greatly enhances error detection and allows for a simple parser). OPTIONAL items are marked with a "*". 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) t=* (One or more time descriptions) r=* (One or more repeat descriptions) z=* (time zone adjustments) k=* (encryption key) a=* (zero or more session attribute lines) Zero or more media descriptions https://tools.ietf.org/html/rfc4566#section-5

Jump to

Keyboard shortcuts

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