mediasoupdata

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MethodWorkerCreateRouter     = "worker.createRouter"
	MethodWorkerDump             = "worker.dump"
	MethodWorkerUpdateSettings   = "worker.updateSettings"
	MethodWorkerGetResourceUsage = "worker.getResourceUsage"
	MethodWorkerClose            = "worker.close"

	MethodRouterCreateWebRtcTransport       = "router.createWebRtcTransport"
	MethodRouterCreatePlainTransport        = "router.createPlainTransport"
	MethodRouterCreatePipeTransport         = "router.createPipeTransport"
	MethodRouterCreateDirectTransport       = "router.createDirectTransport"
	MethodRouterCreateActiveSpeakerObserver = "router.createActiveSpeakerObserver"
	MethodRouterCreateAudioLevelObserver    = "router.createAudioLevelObserver"
	MethodRouterDump                        = "router.dump"
	MethodRouterClose                       = "router.close"

	MethodTransportDump                  = "transport.dump"
	MethodTransportSetMaxIncomingBitrate = "transport.setMaxIncomingBitrate"
	MethodTransportSetMaxOutgoingBitrate = "transport.setMaxOutgoingBitrate"
	MethodTransportProduce               = "transport.produce"
	MethodTransportConsume               = "transport.consume"
	MethodTransportProduceData           = "transport.produceData"
	MethodTransportConsumeData           = "transport.consumeData"
	MethodTransportEnableTraceEvent      = "transport.enableTraceEvent"
	MethodTransportClose                 = "transport.close"
	MethodTransportGetStats              = "transport.getStats"
	MethodTransportConnect               = "transport.connect"
	MethodTransportRestartIce            = "transport.restartIce"

	MethodProducerDump             = "producer.dump"
	MethodProducerPause            = "producer.pause"
	MethodProducerResume           = "producer.resume"
	MethodProducerEnableTraceEvent = "producer.enableTraceEvent"
	MethodProducerClose            = "producer.close"
	MethodProducerGetStats         = "producer.getStats"

	MethodConsumerDump               = "consumer.dump"
	MethodConsumerPause              = "consumer.pause"
	MethodConsumerResume             = "consumer.resume"
	MethodConsumerEnableTraceEvent   = "consumer.enableTraceEvent"
	MethodConsumerSetPreferredLayers = "consumer.setPreferredLayers"
	MethodConsumerSetPriority        = "consumer.setPriority"
	MethodConsumerRequestKeyFrame    = "consumer.requestKeyFrame"
	MethodConsumerClose              = "consumer.close"
	MethodConsumerGetStats           = "consumer.getStats"

	MethodDataProducerClose    = "dataProducer.close"
	MethodDataProducerDump     = "dataProducer.dump"
	MethodDataProducerGetStats = "dataProducer.getStats"

	MethodDataConsumerClose                         = "dataConsumer.close"
	MethodDataConsumerDump                          = "dataConsumer.dump"
	MethodDataConsumerGetStats                      = "dataConsumer.getStats"
	MethodDataConsumerSetBufferedAmountLowThreshold = "dataConsumer.setBufferedAmountLowThreshold"
	MethodDataConsumerGetBufferedAmount             = "dataConsumer.getBufferedAmount"

	MethodRtpObserverPause          = "rtpObserver.pause"
	MethodRtpObserverResume         = "rtpObserver.resume"
	MethodRtpObserverAddProducer    = "rtpObserver.addProducer"
	MethodRtpObserverRemoveProducer = "rtpObserver.removeProducer"
	MethodRtpObserverClose          = "rtpObserver.close"
)
View Source
const (
	MethodPrefixWorker      = "worker"
	MethodPrefixRouter      = "router"
	MethodPrefixTransport   = "transport"
	MethodPrefixProducer    = "producer"
	MethodPrefixConsumer    = "consumer"
	MethodPrefixRtpObserver = "rtpObserver"
)
View Source
const (
	ConsumerType_Simple    ConsumerType = RtpParametersType_Simple
	ConsumerType_Simulcast              = RtpParametersType_Simulcast
	ConsumerType_Svc                    = RtpParametersType_Svc
)
View Source
const (
	PPID_WEBRTC_STRING int = 51
	PPID_WEBRTC_BINARY int = 53
)
View Source
const (
	ProducerType_Simple    ProducerType = RtpParametersType_Simple
	ProducerType_Simulcast              = RtpParametersType_Simulcast
	ProducerType_Svc                    = RtpParametersType_Svc
)
View Source
const (
	MimeSubTypeAudioCodec         = 100
	MimeSubTypeVideoCodec         = 200
	MimeSubTypeComplementaryCodec = 300
	MimeSubTypeFeatureCodec       = 400
)
View Source
const (
	UNKNOWN                RtpHeaderExtensionUri = 0
	MID                                          = 1
	RTP_STREAM_ID                                = 2
	REPAIRED_RTP_STREAM_ID                       = 3
	ABS_SEND_TIME                                = 4
	TRANSPORT_WIDE_CC_01                         = 5
	FRAME_MARKING_07                             = 6 // NOTE: Remove once RFC.
	FRAME_MARKING                                = 7
	SSRC_AUDIO_LEVEL                             = 10
	VIDEO_ORIENTATION                            = 11
	TOFFSET                                      = 12
	ABS_CAPTURE_TIME                             = 13
)
View Source
const (
	RtpParametersType_Simple    RtpParametersType = "simple"
	RtpParametersType_Simulcast                   = "simulcast"
	RtpParametersType_Svc                         = "svc"
	RtpParametersType_Pipe                        = "pipe"
	RtpParametersType_None                        = "none"
)
View Source
const (
	SctpState_New        = "new"
	SctpState_Connecting = "connecting"
	SctpState_Connected  = "connected"
	SctpState_Failed     = "failed"
	SctpState_Closed     = "closed"
)
View Source
const (
	DtlsState_New        = "new"
	DtlsState_Connecting = "connecting"
	DtlsState_Connected  = "connected"
	DtlsState_Failed     = "failed"
	DtlsState_Closed     = "closed"
)

Variables

View Source
var DYNAMIC_PAYLOAD_TYPES = [...]byte{
	100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
	116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 96, 97, 98, 99, 77,
	78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 35, 36,
	37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
	57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
}

Functions

func Bool

func Bool(b bool) *bool

func Init

func Init()

func NewInvalidStateError

func NewInvalidStateError(format string, args ...interface{}) error

func NewTypeError

func NewTypeError(format string, args ...interface{}) error

func NewUnsupportedError

func NewUnsupportedError(format string, args ...interface{}) error

Types

type ActiveSpeakerObserverOptions

type ActiveSpeakerObserverOptions struct {
	Interval int         `json:"interval"`
	AppData  interface{} `json:"appData,omitempty"`
}

type AudioLevelObserverOptions

type AudioLevelObserverOptions struct {
	// MaxEntries is maximum int of entries in the 'volumes”' event. Default 1.
	MaxEntries int `json:"maxEntries"`

	// Threshold is minimum average volume (in dBvo from -127 to 0) for entries in the
	// "volumes" event.	Default -80.
	Threshold int `json:"threshold"`

	// Interval in ms for checking audio volumes. Default 1000.
	Interval int `json:"interval"`

	// AppData is custom application data.
	AppData interface{} `json:"appData,omitempty"`
}

AudioLevelObserverOptions define options to create an AudioLevelObserver.

type ConsumerData

type ConsumerData struct {
	Paused         bool          `json:"paused,omitempty"`
	ProducerPaused bool          `json:"producerPaused,omitempty"`
	Score          ConsumerScore `json:"score,omitempty"`
}

type ConsumerDump

type ConsumerDump struct {
	Id                         string               `json:"id,omitempty"`
	ProducerId                 string               `json:"producerId,omitempty"`
	Kind                       string               `json:"kind,omitempty"`
	Type                       string               `json:"type,omitempty"`
	RtpParameters              RtpParameters        `json:"rtpParameters,omitempty"`
	ConsumableRtpEncodings     []RtpMappingEncoding `json:"consumableRtpEncodings,omitempty"`
	SupportedCodecPayloadTypes []uint32             `json:"supportedCodecPayloadTypes,omitempty"`
	Paused                     bool                 `json:"paused,omitempty"`
	ProducerPaused             bool                 `json:"producerPaused,omitempty"`
	Priority                   uint8                `json:"priority,omitempty"`
	TraceEventTypes            string               `json:"traceEventTypes,omitempty"`
	RtpStreams                 []RtpStream          `json:"rtpStreams,omitempty"`
	RtpStream                  *RtpStream           `json:"rtpStream,omitempty"` // dump by SvcConsumer
	*SimulcastConsumerDump
}

type ConsumerLayers

type ConsumerLayers struct {
	/**
	 * The spatial layer index (from 0 to N).
	 */
	SpatialLayer uint8 `json:"spatialLayer"`

	/**
	 * The temporal layer index (from 0 to N).
	 */
	TemporalLayer uint8 `json:"temporalLayer"`
}

type ConsumerOptions

type ConsumerOptions struct {
	/**
	 * The id of the Producer to consume.
	 */
	ProducerId string `json:"producerId,omitempty"`

	/**
	 * RTP capabilities of the consuming endpoint.
	 */
	RtpCapabilities RtpCapabilities `json:"rtpCapabilities,omitempty"`

	/**
	 * Whether the Consumer must start in paused mode. Default false.
	 *
	 * When creating a video Consumer, it's recommended to set paused to true,
	 * then transmit the Consumer parameters to the consuming endpoint and, once
	 * the consuming endpoint has created its local side Consumer, unpause the
	 * server side Consumer using the resume() method. This is an optimization
	 * to make it possible for the consuming endpoint to render the video as far
	 * as possible. If the server side Consumer was created with paused false,
	 * mediasoup will immediately request a key frame to the remote Producer and
	 * suych a key frame may reach the consuming endpoint even before it's ready
	 * to consume it, generating “black” video until the device requests a keyframe
	 * by itself.
	 */
	Paused bool `json:"paused,omitempty"`

	/**
	 * The MID for the Consumer. If not specified, a sequentially growing
	 * number will be assigned.
	 */
	Mid string `json:"mid,omitempty"`

	/**
	 * Preferred spatial and temporal layer for simulcast or SVC media sources.
	 * If unset, the highest ones are selected.
	 */
	PreferredLayers *ConsumerLayers `json:"preferredLayers,omitempty"`

	/**
	 * Whether this Consumer should consume all RTP streams generated by the
	 * Producer.
	 */
	Pipe bool

	/**
	 * Custom application data.
	 */
	AppData interface{} `json:"appData,omitempty"`

	// input
	Kind                   MediaKind                `json:"kind,omitempty"`
	Type                   ConsumerType             `json:"type,omitempty"`
	RtpParameters          RtpParameters            `json:"rtpParameters,omitempty"`
	ConsumableRtpEncodings []*RtpEncodingParameters `json:"consumableRtpEncodings,omitempty"`
}

type ConsumerScore

type ConsumerScore struct {
	/**
	 * The score of the RTP stream of the consumer.
	 */
	Score uint16 `json:"score"`

	/**
	 * The score of the currently selected RTP stream of the producer.
	 */
	ProducerScore uint16 `json:"producerScore"`

	/**
	 * The scores of all RTP streams in the producer ordered by encoding (just
	 * useful when the producer uses simulcast).
	 */
	ProducerScores []uint16 `json:"producerScores,omitempty"`
}

type ConsumerStat

type ConsumerStat = ProducerStat

type ConsumerType

type ConsumerType = RtpParametersType

*

  • Consumer type.

type DataConsumerDump

type DataConsumerDump struct {
	Id                         string                `json:"id,omitempty"`
	DataProducerId             string                `json:"dataProducerId,omitempty"`
	Type                       string                `json:"type,omitempty"`
	SctpStreamParameters       *SctpStreamParameters `json:"sctpStreamParameters,omitempty"`
	Label                      string                `json:"label,omitempty"`
	Protocol                   string                `json:"protocol,omitempty"`
	BufferedAmount             uint32                `json:"bufferedAmount,omitempty"`
	BufferedAmountLowThreshold uint32                `json:"bufferedAmountLowThreshold,omitempty"`
}

type DataProducerDump

type DataProducerDump struct {
	Id                   string                `json:"id,omitempty"`
	Type                 DataProducerType      `json:"type,omitempty"`
	SctpStreamParameters *SctpStreamParameters `json:"sctpStreamParameters,omitempty"`
	Label                string                `json:"label,omitempty"`
	Protocol             string                `json:"protocol,omitempty"`
}

type DataProducerOptions

type DataProducerOptions struct {
	// Id is DataProducer id (just for Router.pipeToRouter() method).
	DataProducerId string `json:"dataProducerId,omitempty"`

	Type DataProducerType `json:"type,omitempty"`

	// SctpStreamParameters define how the endpoint is sending the data.
	// Just if messages are sent over SCTP.
	SctpStreamParameters *SctpStreamParameters `json:"sctpStreamParameters,omitempty"`

	// Label can be used to distinguish this DataChannel from others.
	Label string `json:"label,omitempty"`

	// Protocol is the name of the sub-protocol used by this DataChannel.
	Protocol string `json:"protocol,omitempty"`

	// AppData is custom application data.
	AppData interface{} `json:"app_data,omitempty"`
}

DataProducerOptions define options to create a DataProducer.

type DataProducerStat

type DataProducerStat struct {
	Type             string
	Timestamp        int64
	Label            string
	Protocol         string
	MessagesReceived int64
	BytesReceived    int64
}

DataProducerStat define the statistic info for DataProducer.

type DataProducerType

type DataProducerType string

DataProducerType define DataProducer type.

const (
	DataProducerType_Sctp   DataProducerType = "sctp"
	DataProducerType_Direct DataProducerType = "direct"
)

type DirectTransportOptions

type DirectTransportOptions struct {
	Direct bool `json:"direct,omitempty"`
	/**
	 * Maximum allowed size for direct messages sent from DataProducers.
	 * Default 262144.
	 */
	MaxMessageSize uint32 `json:"maxMessageSize,omitempty"`
}

type DtlsFingerprint

type DtlsFingerprint struct {
	Algorithm string `json:"algorithm"`
	Value     string `json:"value"`
}

*

  • The hash function algorithm (as defined in the "Hash function Textual Names"
  • registry initially specified in RFC 4572 Section 8) and its corresponding
  • certificate fingerprint value (in lowercase hex string as expressed utilizing
  • the syntax of "fingerprint" in RFC 4572 Section 5).

type DtlsParameters

type DtlsParameters struct {
	Role         DtlsRole          `json:"role,omitempty"`
	Fingerprints []DtlsFingerprint `json:"fingerprints"`
}

type DtlsRole

type DtlsRole string
const (
	DtlsRole_Auto   DtlsRole = "auto"
	DtlsRole_Client DtlsRole = "client"
	DtlsRole_Server DtlsRole = "server"
)

type DtlsState

type DtlsState string

type H

type H map[string]interface{}

type IceCandidate

type IceCandidate struct {
	Foundation string            `json:"foundation"`
	Priority   uint32            `json:"priority"`
	Ip         string            `json:"ip"`
	Protocol   TransportProtocol `json:"protocol"`
	Port       uint32            `json:"port"`
	// always "host"
	Type string `json:"type,omitempty"`
	// "passive" | undefined
	TcpType string `json:"tcpType,omitempty"`
}

type IceParameters

type IceParameters struct {
	UsernameFragment string `json:"usernameFragment"`
	Password         string `json:"password"`
	IceLite          bool   `json:"iceLite,omitempty"`
}

type IceState

type IceState string
const (
	IceState_New          IceState = "new"
	IceState_Connected    IceState = "connected"
	IceState_Completed    IceState = "completed"
	IceState_Disconnected IceState = "disconnected"
	IceState_Closed       IceState = "closed"
)

type InvalidStateError

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

InvalidStateError produced when calling a method in an invalid state.

func (InvalidStateError) Error

func (e InvalidStateError) Error() string

type MediaKind

type MediaKind string

*

  • Media kind ('audio' or 'video').
const (
	MediaKind_Audio MediaKind = "audio"
	MediaKind_Video MediaKind = "video"
)

type MimeSubType

type MimeSubType int32
const (
	MimeSubTypeOPUS MimeSubType = MimeSubTypeAudioCodec + iota
	// Multi-channel Opus.
	MimeSubTypeMULTIOPUS
	MimeSubTypePCMA
	MimeSubTypePCMU
	MimeSubTypeISAC
	MimeSubTypeG722
	MimeSubTypeILBC
	MimeSubTypeSILK
)

Audio codecs:

const (
	MimeSubTypeVP8 MimeSubType = MimeSubTypeVideoCodec + iota
	MimeSubTypeVP9
	MimeSubTypeH264
	MimeSubTypeX_H264UC
	MimeSubTypeH265
)

Video codecs:

const (
	MimeSubTypeCN MimeSubType = MimeSubTypeComplementaryCodec + iota
	MimeSubTypeTELEPHONE_EVENT
)

Complementary codecs:

const (
	MimeSubTypeRTX MimeSubType = MimeSubTypeFeatureCodec + iota
	MimeSubTypeULPFEC
	MimeSubTypeX_ULPFECUC
	MimeSubTypeFLEXFEC
	MimeSubTypeRED
)

Feature codecs:

const (
	MimeSubTypeUNSET MimeSubType = iota
)

type MimeType

type MimeType int32
const (
	MimeTypeUnset MimeType = iota
	MimeTypeAudio
	MimeTypeVideo
)

type NumSctpStreams

type NumSctpStreams struct {
	/**
	 * Initially requested int of outgoing SCTP streams.
	 */
	OS uint16 `json:"OS"`

	/**
	 * Maximum int of incoming SCTP streams.
	 */
	MIS uint16 `json:"MIS"`
}

*

  • Both OS and MIS are part of the SCTP INIT+ACK handshake. OS refers to the
  • initial int of outgoing SCTP streams that the server side transport creates
  • (to be used by DataConsumers), while MIS refers to the maximum int of
  • incoming SCTP streams that the server side transport can receive (to be used
  • by DataProducers). So, if the server side transport will just be used to
  • create data producers (but no data consumers), OS can be low (~1). However,
  • if data consumers are desired on the server side transport, OS must have a
  • proper value and such a proper value depends on whether the remote endpoint
  • supports SCTP_ADD_STREAMS extension or not. *
  • libwebrtc (Chrome, Safari, etc) does not enable SCTP_ADD_STREAMS so, if data
  • consumers are required, OS should be 1024 (the maximum int of DataChannels
  • that libwebrtc enables). *
  • Firefox does enable SCTP_ADD_STREAMS so, if data consumers are required, OS
  • can be lower (16 for instance). The mediasoup transport will allocate and
  • announce more outgoing SCTM streams when needed. *
  • mediasoup-client provides specific per browser/version OS and MIS values via
  • the device.sctpCapabilities getter.

type PipeTransportData

type PipeTransportData struct {
	Tuple          TransportTuple  `json:"tuple,omitempty"`
	SctpParameters SctpParameters  `json:"sctpParameters,omitempty"`
	SctpState      SctpState       `json:"sctpState,omitempty"`
	Rtx            bool            `json:"rtx,omitempty"`
	SrtpParameters *SrtpParameters `json:"srtpParameters,omitempty"`
}

type PipeTransportOptions

type PipeTransportOptions struct {
	/**
	 * Listening IP address.
	 */
	ListenIp TransportListenIp `json:"listenIp,omitempty"`
	Port     uint16            `json:"port,omitempty"`

	SctpOptions
	/**
	 * Enable RTX and NACK for RTP retransmission. Useful if both Routers are
	 * located in different hosts and there is packet lost in the link. For this
	 * to work, both PipeTransports must enable this setting. Default false.
	 */
	EnableRtx bool `json:"enableRtx,omitempty"`

	/**
	 * Enable SRTP. Useful to protect the RTP and RTCP traffic if both Routers
	 * are located in different hosts. For this to work, connect() must be called
	 * with remote SRTP parameters. Default false.
	 */
	EnableSrtp bool `json:"enableSrtp,omitempty"`

	/**
	 * Custom application data.
	 */
	AppData interface{} `json:"appData,omitempty"`
}

type PlainTransportDump

type PlainTransportDump struct {
	RtcpMux        bool            `json:"rtcpMux,omitempty"`
	Comedia        bool            `json:"comedia,omitempty"`
	Tuple          *TransportTuple `json:"tuple,omitempty"`
	RtcpTuple      *TransportTuple `json:"rtcpTuple,omitempty"`
	SrtpParameters *SrtpParameters `json:"srtpParameters,omitempty"`
}

type ProducerData

type ProducerData struct {
	Kind                    MediaKind     `json:"kind,omitempty"`
	Type                    ProducerType  `json:"type,omitempty"`
	RtpParameters           RtpParameters `json:"rtpParameters,omitempty"`
	ConsumableRtpParameters RtpParameters `json:"consumableRtpParameters,omitempty"`
}

type ProducerDump

type ProducerDump struct {
	Id              string             `json:"id,omitempty"`
	Kind            string             `json:"kind,omitempty"`
	Type            string             `json:"type,omitempty"`
	RtpParameters   RtpParameters      `json:"rtpParameters,omitempty"`
	RtpMapping      RtpMapping         `json:"rtpMapping,omitempty"`
	Encodings       RtpMappingEncoding `json:"encodings,omitempty"`
	RtpStreams      []RtpStream        `json:"rtpStreams,omitempty"`
	Paused          bool               `json:"paused,omitempty"`
	TraceEventTypes string             `json:"traceEventTypes,omitempty"`
}

type ProducerOptions

type ProducerOptions struct {
	/**
	 * Producer id (just for Router.pipeToRouter() method).
	 */
	Id string `json:"id,omitempty"`

	/**
	 * Media kind ('audio' or 'video').
	 */
	Kind MediaKind `json:"kind,omitempty"`

	/**
	 * RTP parameters defining what the endpoint is sending.
	 */
	RtpParameters RtpParameters `json:"rtpParameters,omitempty"`

	/**
	 * Whether the producer must start in paused mode. Default false.
	 */
	Paused bool `json:"paused,omitempty"`

	/**
	 * Just for video. Time (in ms) before asking the sender for a new key frame
	 * after having asked a previous one. Default 0.
	 */
	KeyFrameRequestDelay uint32 `json:"keyFrameRequestDelay,omitempty"`

	/**
	 * Custom application data.
	 */
	AppData interface{} `json:"appData,omitempty"`

	RtpMapping RtpMapping `json:"rtpMapping"`
}

func (ProducerOptions) Valid

func (o ProducerOptions) Valid() bool

type ProducerStat

type ProducerStat struct {
	// Common to all RtpStreams.
	Type                 string  `json:"type,omitempty"`
	Timestamp            int64   `json:"timestamp,omitempty"`
	Ssrc                 uint32  `json:"ssrc,omitempty"`
	RtxSsrc              uint32  `json:"rtxSsrc,omitempty"`
	Rid                  string  `json:"rid,omitempty"`
	Kind                 string  `json:"kind,omitempty"`
	MimeType             string  `json:"mimeType,omitempty"`
	PacketsLost          uint32  `json:"packetsLost,omitempty"`
	FractionLost         uint8   `json:"fractionLost,omitempty"`
	PacketsDiscarded     uint32  `json:"packetsDiscarded,omitempty"`
	PacketsRetransmitted uint32  `json:"packetsRetransmitted,omitempty"`
	PacketsRepaired      uint32  `json:"packetsRepaired,omitempty"`
	NackCount            uint32  `json:"nackCount,omitempty"`
	NackPacketCount      uint32  `json:"nackPacketCount,omitempty"`
	PliCount             uint32  `json:"pliCount,omitempty"`
	FirCount             uint32  `json:"firCount,omitempty"`
	Score                uint32  `json:"score,omitempty"`
	PacketCount          int64   `json:"packetCount,omitempty"`
	ByteCount            int64   `json:"byteCount,omitempty"`
	Bitrate              uint32  `json:"bitrate,omitempty"`
	RoundTripTime        float32 `json:"roundTripTime,omitempty"`
	RtxPacketsDiscarded  uint32  `json:"rtxPacketsDiscarded,omitempty"`

	// RtpStreamRecv specific.
	Jitter         uint32 `json:"jitter,omitempty"`
	BitrateByLayer H      `json:"bitrateByLayer,omitempty"`
}

type ProducerType

type ProducerType = RtpParametersType

*

  • Producer type.

type RecvRtpHeaderExtensions

type RecvRtpHeaderExtensions struct {
	Mid               uint8 `json:"mid,omitempty"`
	Rid               uint8 `json:"rid,omitempty"`
	Rrid              uint8 `json:"rrid,omitempty"`
	AbsSendTime       uint8 `json:"absSendTime,omitempty"`
	TransportWideCc01 uint8 `json:"transportWideCc01,omitempty"`
}

type RouterDump

type RouterDump struct {
	Id                               string              `json:"id,omitempty"`
	TransportIds                     []string            `json:"transportIds,omitempty"`
	RtpObserverIds                   []string            `json:"rtpObserverIds,omitempty"`
	MapProducerIdConsumerIds         map[string][]string `json:"mapProducerIdConsumerIds,omitempty"`
	MapConsumerIdProducerId          map[string]string   `json:"mapConsumerIdProducerId,omitempty"`
	MapProducerIdObserverIds         map[string][]string `json:"mapProducerIdObserverIds,omitempty"`
	MapDataProducerIdDataConsumerIds map[string][]string `json:"mapDataProducerIdDataConsumerIds,omitempty"`
	MapDataConsumerIdDataProducerId  map[string]string   `json:"mapDataConsumerIdDataProducerId,omitempty"`
}

type RouterOptions

type RouterOptions struct {
	/**
	 * Router media codecs.
	 */
	MediaCodecs []*RtpCodecCapability `json:"mediaCodecs,omitempty"`

	/**
	 * Custom application data.
	 */
	AppData interface{} `json:"appData,omitempty"`
}

type RtcpFeedback

type RtcpFeedback struct {
	/**
	 * RTCP feedback type.
	 */
	Type string `json:"type"`

	/**
	 * RTCP feedback parameter.
	 */
	Parameter string `json:"parameter,omitempty"`
}

*

  • Provides information on RTCP feedback messages for a specific codec. Those
  • messages can be transport layer feedback messages or codec-specific feedback
  • messages. The list of RTCP feedbacks supported by mediasoup is defined in the
  • supportedRtpCapabilities.ts file.

type RtcpParameters

type RtcpParameters struct {
	/**
	 * The Canonical Name (CNAME) used by RTCP (e.g. in SDES messages).
	 */
	Cname string `json:"cname,omitempty"`

	/**
	 * Whether reduced size RTCP RFC 5506 is configured (if true) or compound RTCP
	 * as specified in RFC 3550 (if false). Default true.
	 */
	ReducedSize *bool `json:"reducedSize,omitempty"`

	/**
	 * Whether RTCP-mux is used. Default true.
	 */
	Mux *bool `json:"mux,omitempty"`
}

*

  • Provides information on RTCP settings within the RTP parameters. *
  • If no cname is given in a producer's RTP parameters, the mediasoup transport
  • will choose a random one that will be used into RTCP SDES messages sent to
  • all its associated consumers. *
  • mediasoup assumes reducedSize to always be true.

type RtpCapabilities

type RtpCapabilities struct {
	/**
	 * Supported media and RTX codecs.
	 */
	Codecs []*RtpCodecCapability `json:"codecs,omitempty"`

	/**
	 * Supported RTP header extensions.
	 */
	HeaderExtensions []*RtpHeaderExtension `json:"headerExtensions,omitempty"`

	/**
	 * Supported FEC mechanisms.
	 */
	FecMechanisms []string `json:"fecMechanisms,omitempty"`
}

*

  • The RTP capabilities define what mediasoup or an endpoint can receive at
  • media level.

func GenerateRouterRtpCapabilities

func GenerateRouterRtpCapabilities(mediaCodecs []*RtpCodecCapability) (caps RtpCapabilities, err error)

*

  • Generate RTP capabilities for the Router based on the given media codecs and
  • mediasoup supported RTP capabilities.

func GetSupportedRtpCapabilities

func GetSupportedRtpCapabilities() (rtpCapabilities RtpCapabilities)

type RtpCodecCapability

type RtpCodecCapability struct {
	/**
	 * Media kind.
	 */
	Kind MediaKind `json:"kind"`

	/**
	 * The codec MIME media type/subtype (e.g. 'audio/opus', 'video/VP8').
	 */
	MimeType string `json:"mimeType"`

	/**
	 * The preferred RTP payload type.
	 */
	PreferredPayloadType uint8 `json:"preferredPayloadType,omitempty"`

	/**
	 * Codec clock rate expressed in Hertz.
	 */
	ClockRate int `json:"clockRate"`

	/**
	 * The int of channels supported (e.g. two for stereo). Just for audio.
	 * Default 1.
	 */
	Channels uint8 `json:"channels,omitempty"`

	/**
	 * Codec specific parameters. Some parameters (such as 'packetization-mode'
	 * and 'profile-level-id' in H264 or 'profile-id' in VP9) are critical for
	 * codec matching.
	 */
	Parameters RtpCodecSpecificParameters `json:"parameters,omitempty"`

	/**
	 * Transport layer and codec-specific feedback messages for this codec.
	 */
	RtcpFeedback []RtcpFeedback `json:"rtcpFeedback,omitempty"`
}

*

  • Provides information on the capabilities of a codec within the RTP
  • capabilities. The list of media codecs supported by mediasoup and their
  • settings is defined in the supportedRtpCapabilities.ts file. *
  • Exactly one RtpCodecCapability will be present for each supported combination
  • of parameters that requires a distinct value of preferredPayloadType. For
  • example *
  • - Multiple H264 codecs, each with their own distinct 'packetization-mode' and
  • 'profile-level-id' values.
  • - Multiple VP9 codecs, each with their own distinct 'profile-id' value. *
  • RtpCodecCapability entries in the mediaCodecs array of RouterOptions do not
  • require preferredPayloadType field (if unset, mediasoup will choose a random
  • one). If given, make sure it's in the 96-127 range.

type RtpCodecMimeType

type RtpCodecMimeType struct {
	Type     MimeType
	SubType  MimeSubType
	MimeType string
}

func (RtpCodecMimeType) IsComplementaryCodec

func (r RtpCodecMimeType) IsComplementaryCodec() bool

func (RtpCodecMimeType) IsFeatureCodec

func (r RtpCodecMimeType) IsFeatureCodec() bool

func (RtpCodecMimeType) IsMediaCodec

func (r RtpCodecMimeType) IsMediaCodec() bool

func (*RtpCodecMimeType) SetMimeType

func (r *RtpCodecMimeType) SetMimeType(mimeType string) error

func (RtpCodecMimeType) SubType2String

func (r RtpCodecMimeType) SubType2String() string

func (RtpCodecMimeType) Type2String

func (r RtpCodecMimeType) Type2String() string

func (*RtpCodecMimeType) UpdateMimeType

func (r *RtpCodecMimeType) UpdateMimeType()

type RtpCodecParameters

type RtpCodecParameters struct {
	/**
	 * The codec MIME media type/subtype (e.g. 'audio/opus', 'video/VP8').
	 */
	MimeType string `json:"mimeType"`

	/**
	 * The value that goes in the RTP Payload Type Field. Must be unique.
	 */
	PayloadType uint8 `json:"payloadType"`

	/**
	 * Codec clock rate expressed in Hertz.
	 */
	ClockRate int `json:"clockRate"`

	/**
	 * The int of channels supported (e.g. two for stereo). Just for audio.
	 * Default 1.
	 */
	Channels uint8 `json:"channels,omitempty"`

	/**
	 * Codec-specific parameters available for signaling. Some parameters (such
	 * as 'packetization-mode' and 'profile-level-id' in H264 or 'profile-id' in
	 * VP9) are critical for codec matching.
	 */
	Parameters RtpCodecSpecificParameters `json:"parameters,omitempty"`

	/**
	 * Transport layer and codec-specific feedback messages for this codec.
	 */
	RtcpFeedback []RtcpFeedback `json:"rtcpFeedback,omitempty"`

	RtpCodecMimeType RtpCodecMimeType `json:"-"`
}

*

  • Provides information on codec settings within the RTP parameters. The list
  • of media codecs supported by mediasoup and their settings is defined in the
  • supportedRtpCapabilities.ts file.

func (*RtpCodecParameters) CheckCodec

func (r *RtpCodecParameters) CheckCodec() error

func (*RtpCodecParameters) Init

func (r *RtpCodecParameters) Init() error

type RtpCodecSpecificParameters

type RtpCodecSpecificParameters struct {
	h264.RtpParameter          // used by h264 codec
	ProfileId           uint8  `json:"profile-id,omitempty"`   // used by vp9  https://www.webmproject.org/vp9/profiles/
	Apt                 byte   `json:"apt,omitempty"`          // used by rtx codec
	SpropStereo         uint8  `json:"sprop-stereo,omitempty"` // used by audio, 1 or 0
	Useinbandfec        uint8  `json:"useinbandfec,omitempty"` // used by audio, 1 or 0
	Usedtx              uint8  `json:"usedtx,omitempty"`       // used by audio, 1 or 0
	Maxplaybackrate     uint32 `json:"maxplaybackrate,omitempty"`
	XGoogleMinBitrate   uint32 `json:"x-google-min-bitrate,omitempty"`
	XGoogleMaxBitrate   uint32 `json:"x-google-max-bitrate,omitempty"`
	XGoogleStartBitrate uint32 `json:"x-google-start-bitrate,omitempty"`
	ChannelMapping      string `json:"channel_mapping,omitempty"`
	NumStreams          uint8  `json:"num_streams,omitempty"`
	CoupledStreams      uint8  `json:"coupled_streams,omitempty"`
}

*

  • RtpCodecSpecificParameters the Codec-specific parameters available for signaling. Some parameters (such
  • as 'packetization-mode' and 'profile-level-id' in H264 or 'profile-id' in
  • VP9) are critical for codec matching.

type RtpEncodingParameters

type RtpEncodingParameters struct {
	/**
	 * The media SSRC.
	 */
	Ssrc uint32 `json:"ssrc,omitempty"`

	/**
	 * The RID RTP extension value. Must be unique.
	 */
	Rid string `json:"rid,omitempty"`

	/**
	 * Codec payload type this encoding affects. If unset, first media codec is
	 * chosen.
	 */
	CodecPayloadType    byte `json:"codecPayloadType,omitempty"`
	HasCodecPayloadType bool `json:"-"`

	/**
	 * RTX stream information. It must contain a numeric ssrc field indicating
	 * the RTX SSRC.
	 */
	Rtx *RtpEncodingRtx `json:"rtx,omitempty"`

	/**
	 * It indicates whether discontinuous RTP transmission will be used. Useful
	 * for audio (if the codec supports it) and for video screen sharing (when
	 * static content is being transmitted, this option disables the RTP
	 * inactivity checks in mediasoup). Default false.
	 */
	Dtx bool `json:"dtx,omitempty"`

	/**
	 * int of spatial and temporal layers in the RTP stream (e.g. 'L1T3').
	 * See webrtc-svc.
	 */
	ScalabilityMode string `json:"scalabilityMode,omitempty"`

	/**
	 * Others.
	 */
	ScaleResolutionDownBy int `json:"scaleResolutionDownBy,omitempty"`
	MaxBitrate            int `json:"maxBitrate,omitempty"`

	SpatialLayers  uint8 `json:"-"` // default 1
	TemporalLayers uint8 `json:"-"` // default 1
}

*

  • Provides information relating to an encoding, which represents a media RTP
  • stream and its associated RTX stream (if any).

type RtpEncodingRtx

type RtpEncodingRtx struct {
	Ssrc uint32 `json:"ssrc"`
}

RtpEncodingRtx represents the associated RTX stream for RTP stream.

type RtpHeaderExtension

type RtpHeaderExtension struct {
	/**
	 * Media kind. If empty string, it's valid for all kinds.
	 * Default any media kind.
	 */
	Kind MediaKind `json:"kind"`

	/*
	 * The URI of the RTP header extension, as defined in RFC 5285.
	 */
	Uri string `json:"uri"`

	/**
	 * The preferred numeric identifier that goes in the RTP packet. Must be
	 * unique.
	 */
	PreferredId int `json:"preferredId"`

	/**
	 * If true, it is preferred that the value in the header be encrypted as per
	 * RFC 6904. Default false.
	 */
	PreferredEncrypt bool `json:"preferredEncrypt,omitempty"`

	/**
	 * If 'sendrecv', mediasoup supports sending and receiving this RTP extension.
	 * 'sendonly' means that mediasoup can send (but not receive) it. 'recvonly'
	 * means that mediasoup can receive (but not send) it.
	 */
	Direction RtpHeaderExtensionDirection `json:"direction,omitempty"`
}

*

  • Provides information relating to supported header extensions. The list of
  • RTP header extensions supported by mediasoup is defined in the
  • supportedRtpCapabilities.ts file. *
  • mediasoup does not currently support encrypted RTP header extensions. The
  • direction field is just present in mediasoup RTP capabilities (retrieved via
  • router.rtpCapabilities or mediasoup.getSupportedRtpCapabilities()). It's
  • ignored if present in endpoints' RTP capabilities.

type RtpHeaderExtensionDirection

type RtpHeaderExtensionDirection string

*

  • Direction of RTP header extension.
const (
	Direction_Sendrecv RtpHeaderExtensionDirection = "sendrecv"
	Direction_Sendonly RtpHeaderExtensionDirection = "sendonly"
	Direction_Recvonly RtpHeaderExtensionDirection = "recvonly"
	Direction_Inactive RtpHeaderExtensionDirection = "inactive"
)

type RtpHeaderExtensionParameters

type RtpHeaderExtensionParameters struct {
	/**
	 * The URI of the RTP header extension, as defined in RFC 5285.
	 */
	Uri string `json:"uri"`

	/**
	 * The numeric identifier that goes in the RTP packet. Must be unique.
	 */
	Id int `json:"id"`

	/**
	 * If true, the value in the header is encrypted as per RFC 6904. Default false.
	 */
	Encrypt bool `json:"encrypt,omitempty"`

	/**
	 * Configuration parameters for the header extension.
	 */
	Parameters *RtpCodecSpecificParameters `json:"parameters,omitempty"`

	Type RtpHeaderExtensionUri
}

*

  • Defines a RTP header extension within the RTP parameters. The list of RTP
  • header extensions supported by mediasoup is defined in the
  • supportedRtpCapabilities.ts file. *
  • mediasoup does not currently support encrypted RTP header extensions and no
  • parameters are currently considered.

type RtpHeaderExtensionUri

type RtpHeaderExtensionUri uint8

func GetRtpHeaderExtensionUri

func GetRtpHeaderExtensionUri(uri string) RtpHeaderExtensionUri

type RtpListener

type RtpListener struct {
	SsrcTable map[string]string `json:"ssrcTable,omitempty"`
	MidTable  map[string]string `json:"midTable,omitempty"`
	RidTable  map[string]string `json:"ridTable,omitempty"`
}

type RtpMapping

type RtpMapping struct {
	Codecs    []RtpMappingCodec    `json:"codecs,omitempty"`
	Encodings []RtpMappingEncoding `json:"encodings,omitempty"`
}

func GetProducerRtpParametersMapping

func GetProducerRtpParametersMapping(params RtpParameters, caps RtpCapabilities) (rtpMapping RtpMapping, err error)

*

  • Get a mapping of the codec payload, RTP header extensions and encodings from
  • the given Producer RTP parameters to the values expected by the Router. *

func (RtpMapping) Valid

func (r RtpMapping) Valid() bool

type RtpMappingCodec

type RtpMappingCodec struct {
	PayloadType       byte `json:"payloadType"`
	MappedPayloadType byte `json:"mappedPayloadType"`
}

func (RtpMappingCodec) Valid

func (r RtpMappingCodec) Valid() bool

type RtpMappingEncoding

type RtpMappingEncoding struct {
	Ssrc            uint32 `json:"ssrc,omitempty"`
	Rid             string `json:"rid,omitempty"`
	ScalabilityMode string `json:"scalabilityMode,omitempty"`
	MappedSsrc      uint32 `json:"mappedSsrc"`
}

func (RtpMappingEncoding) Valid

func (r RtpMappingEncoding) Valid() bool

type RtpParameters

type RtpParameters struct {
	/**
	 * The MID RTP extension value as defined in the BUNDLE specification.
	 */
	Mid string `json:"mid,omitempty"`

	/**
	 * Media and RTX codecs in use.
	 */
	Codecs []*RtpCodecParameters `json:"codecs"`

	/**
	 * RTP header extensions in use.
	 */
	HeaderExtensions []RtpHeaderExtensionParameters `json:"headerExtensions,omitempty"`

	/**
	 * Transmitted RTP streams and their settings.
	 */
	Encodings []*RtpEncodingParameters `json:"encodings,omitempty"`

	/**
	 * Parameters used for RTCP.
	 */
	Rtcp RtcpParameters `json:"rtcp,omitempty"`

	HasRtcp bool `json:"-"`
}

*

  • The RTP send parameters describe a media stream received by mediasoup from
  • an endpoint through its corresponding mediasoup Producer. These parameters
  • may include a mid value that the mediasoup transport will use to match
  • received RTP packets based on their MID RTP extension value. *
  • mediasoup allows RTP send parameters with a single encoding and with multiple
  • encodings (simulcast). In the latter case, each entry in the encodings array
  • must include a ssrc field or a rid field (the RID RTP extension value). Check
  • the Simulcast and SVC sections for more information. *
  • The RTP receive parameters describe a media stream as sent by mediasoup to
  • an endpoint through its corresponding mediasoup Consumer. The mid value is
  • unset (mediasoup does not include the MID RTP extension into RTP packets
  • being sent to endpoints). *
  • There is a single entry in the encodings array (even if the corresponding
  • producer uses simulcast). The consumer sends a single and continuous RTP
  • stream to the endpoint and spatial/temporal layer selection is possible via
  • consumer.setPreferredLayers(). *
  • As an exception, previous bullet is not true when consuming a stream over a
  • PipeTransport, in which all RTP streams from the associated producer are
  • forwarded verbatim through the consumer. *
  • The RTP receive parameters will always have their ssrc values randomly
  • generated for all of its encodings (and optional rtx { ssrc XXXX } if the
  • endpoint supports RTX), regardless of the original RTP send parameters in
  • the associated producer. This applies even if the producer's encodings have
  • rid set.

func GetConsumableRtpParameters

func GetConsumableRtpParameters(
	kind MediaKind,
	params RtpParameters,
	caps RtpCapabilities,
	rtpMapping RtpMapping,
) (consumableParams RtpParameters, err error)

*

  • Generate RTP parameters for Consumers given the RTP parameters of a Producer
  • and the RTP capabilities of the Router. *

func GetConsumerRtpParameters

func GetConsumerRtpParameters(consumableParams RtpParameters, caps RtpCapabilities, pipe bool) (consumerParams RtpParameters, err error)

*

  • Generate RTP parameters for a specific Consumer. *
  • It reduces encodings to just one and takes into account given RTP capabilities
  • to reduce codecs, codecs" RTCP feedback and header extensions, and also enables
  • or disabled RTX. *

func (*RtpParameters) GetCodecForEncoding

func (r *RtpParameters) GetCodecForEncoding(encoding *RtpEncodingParameters) *RtpCodecParameters

func (*RtpParameters) GetRtxCodecForEncoding

func (r *RtpParameters) GetRtxCodecForEncoding(encoding *RtpEncodingParameters) *RtpCodecParameters

func (*RtpParameters) GetType

func (r *RtpParameters) GetType() ProducerType

func (*RtpParameters) Init

func (r *RtpParameters) Init() error

func (*RtpParameters) Valid

func (r *RtpParameters) Valid() bool

type RtpParametersType

type RtpParametersType string

type RtpStream

type RtpStream struct {
	Params    RtpStreamParams `json:"params,omitempty"`
	Score     uint8           `json:"score,omitempty"`
	RtxStream *RtpStream      `json:"rtxStream,omitempty"`
}

type RtpStreamParams

type RtpStreamParams struct {
	EncodingIdx    int    `json:"encodingIdx,omitempty"`
	Ssrc           uint32 `json:"ssrc,omitempty"`
	PayloadType    uint8  `json:"payloadType,omitempty"`
	MimeType       string `json:"mimeType,omitempty"`
	ClockRate      uint32 `json:"clockRate,omitempty"`
	Rid            string `json:"rid,omitempty"`
	RRid           string `json:"rrid,omitempty"`
	Cname          string `json:"cname,omitempty"`
	RtxSsrc        uint32 `json:"rtxSsrc,omitempty"`
	RtxPayloadType uint8  `json:"rtxPayloadType,omitempty"`
	UseNack        bool   `json:"useNack,omitempty"`
	UsePli         bool   `json:"usePli,omitempty"`
	UseFir         bool   `json:"useFir,omitempty"`
	UseInBandFec   bool   `json:"useInBandFec,omitempty"`
	UseDtx         bool   `json:"useDtx,omitempty"`
	SpatialLayers  uint8  `json:"spatialLayers,omitempty"`
	TemporalLayers uint8  `json:"temporalLayers,omitempty"`
}

type ScalabilityMode

type ScalabilityMode struct {
	SpatialLayers  uint8 `json:"spatialLayers"`
	TemporalLayers uint8 `json:"temporalLayers"`
	Ksvc           bool  `json:"ksvc"`
}

func ParseScalabilityMode

func ParseScalabilityMode(scalabilityMode string) ScalabilityMode

type SctpCapabilities

type SctpCapabilities struct {
	NumStreams NumSctpStreams `json:"numStreams"`
}

type SctpListener

type SctpListener struct {
	StreamIdTable map[string]string `json:"streamIdTable,omitempty"`
}

type SctpOptions

type SctpOptions struct {

	/**
	 * Create a SCTP association. Default false.
	 */
	EnableSctp bool `json:"enableSctp,omitempty"`

	/**
	 * SCTP streams number.
	 */
	NumSctpStreams NumSctpStreams `json:"numSctpStreams,omitempty"`

	/**
	 * Maximum allowed size for SCTP messages sent by DataProducers.
	 * Default 268435456.
	 */
	MaxSctpMessageSize uint32 `json:"maxSctpMessageSize,omitempty"`

	/**
	 * Maximum SCTP send buffer used by DataConsumers.
	 * Default 268435456.
	 */
	SctpSendBufferSize int `json:"sctpSendBufferSize,omitempty"`

	IsDataChannel bool `json:"isDataChannel,omitempty"`
}

type SctpParameters

type SctpParameters struct {
	/**
	 * Must always equal 5000.
	 */
	Port uint16 `json:"port"`

	/**
	 * Initially requested int of outgoing SCTP streams.
	 */
	OS uint16 `json:"OS"`

	/**
	 * Maximum int of incoming SCTP streams.
	 */
	MIS uint16 `json:"MIS"`

	/**
	 * Maximum allowed size for SCTP messages.
	 */
	MaxMessageSize uint32 `json:"maxMessageSize"`

	/**
	 * Set by worker.
	 */
	IsDataChannel      bool `json:"isDataChannel,omitempty"`
	SctpBufferedAmount int  `json:"sctpBufferedAmount,omitempty"`
	SendBufferSize     int  `json:"sendBufferSize,omitempty"`
}

type SctpState

type SctpState string

type SctpStreamParameters

type SctpStreamParameters struct {
	/**
	 * SCTP stream id.
	 */
	StreamId uint16 `json:"streamId"`

	/**
	 * Whether data messages must be received in order. If true the messages will
	 * be sent reliably. Default true.
	 */
	Ordered *bool `json:"ordered,omitempty"`

	/**
	 * When ordered is false indicates the time (in milliseconds) after which a
	 * SCTP packet will stop being retransmitted.
	 */
	MaxPacketLifeTime uint16 `json:"maxPacketLifeTime,omitempty"`

	/**
	 * When ordered is false indicates the maximum number of times a packet will
	 * be retransmitted.
	 */
	MaxRetransmits uint16 `json:"maxRetransmits,omitempty"`
}

*

  • SCTP stream parameters describe the reliability of a certain SCTP stream.
  • If ordered is true then maxPacketLifeTime and maxRetransmits must be
  • false.
  • If ordered if false, only one of maxPacketLifeTime or maxRetransmits
  • can be true.

type SimulcastConsumerDump

type SimulcastConsumerDump struct {
	PreferredSpatialLayer  int16 `json:"preferredSpatialLayer,omitempty"`
	TargetSpatialLayer     int16 `json:"targetSpatialLayer,omitempty"`
	CurrentSpatialLayer    int16 `json:"currentSpatialLayer,omitempty"`
	PreferredTemporalLayer int16 `json:"preferredTemporalLayer,omitempty"`
	TargetTemporalLayer    int16 `json:"targetTemporalLayer,omitempty"`
	CurrentTemporalLayer   int16 `json:"currentTemporalLayer,omitempty"`
}

type SrtpCryptoSuite

type SrtpCryptoSuite string

*

  • SRTP crypto suite.
const (
	AES_CM_128_HMAC_SHA1_80 SrtpCryptoSuite = "AES_CM_128_HMAC_SHA1_80"
	AES_CM_128_HMAC_SHA1_32 SrtpCryptoSuite = "AES_CM_128_HMAC_SHA1_32"
)

type SrtpParameters

type SrtpParameters struct {
	/**
	 * Encryption and authentication transforms to be used.
	 */
	CryptoSuite SrtpCryptoSuite `json:"cryptoSuite"`

	/**
	 * SRTP keying material (master key and salt) in Base64.
	 */
	KeyBase64  string `json:"keyBase64"`
	SaltBase64 string `json:"saltBase64"`
}

*

  • SRTP parameters.

type TransportConnectData

type TransportConnectData struct {
	// webrtc transport
	DtlsLocalRole DtlsRole `json:"dtlsLocalRole,omitempty"`
	// pipe transport
	Tuple TransportTuple `json:"tuple,omitempty"`
}

type TransportConnectOptions

type TransportConnectOptions struct {
	// pipe and plain transport
	Ip             string          `json:"ip,omitempty"`
	Port           uint16          `json:"port,omitempty"`
	SrtpParameters *SrtpParameters `json:"srtpParameters,omitempty"`

	// plain transport
	RtcpPort uint16 `json:"rtcpPort,omitempty"`

	// webrtc transport
	DtlsParameters *DtlsParameters `json:"dtlsParameters,omitempty"`
}

type TransportDump

type TransportDump struct {
	Id                      string                   `json:"id,omitempty"`
	Direct                  bool                     `json:"direct,omitempty"`
	ProducerIds             []string                 `json:"producerIds,omitempty"`
	ConsumerIds             []string                 `json:"consumerIds,omitempty"`
	MapSsrcConsumerId       map[string]string        `json:"mapSsrcConsumerId,omitempty"`
	MapRtxSsrcConsumerId    map[string]string        `json:"mapRtxSsrcConsumerId,omitempty"`
	DataProducerIds         []string                 `json:"dataProducerIds,omitempty"`
	DataConsumerIds         []string                 `json:"dataConsumerIds,omitempty"`
	RecvRtpHeaderExtensions *RecvRtpHeaderExtensions `json:"recvRtpHeaderExtensions,omitempty"`
	RtpListener             *RtpListener             `json:"rtpListener,omitempty"`
	SctpParameters          SctpParameters           `json:"sctpParameters,omitempty"`
	SctpState               SctpState                `json:"sctpState,omitempty"`
	SctpListener            *SctpListener            `json:"sctpListener,omitempty"`
	TraceEventTypes         string                   `json:"traceEventTypes,omitempty"`

	// plain transport
	*PlainTransportDump

	// webrtc transport
	*WebRtcTransportDump
}

type TransportListenIp

type TransportListenIp struct {
	/**
	 * Listening IPv4 or IPv6.
	 */
	Ip string `json:"ip,omitempty"`

	/**
	 * Announced IPv4 or IPv6 (useful when running mediasoup behind NAT with
	 * private IP).
	 */
	AnnouncedIp string `json:"announcedIp,omitempty"`
}

type TransportOptions

type TransportOptions struct {
	DirectTransportOptions
	SctpOptions
	InitialAvailableOutgoingBitrate uint32 `json:"initialAvailableOutgoingBitrate,omitempty"`
}

type TransportProtocol

type TransportProtocol string

*

  • Transport protocol.
const (
	TransportProtocol_Udp TransportProtocol = "udp"
	TransportProtocol_Tcp TransportProtocol = "tcp"
)

type TransportStat

type TransportStat struct {
	// Common to all Transports.
	Type                     string    `json:"type,omitempty"`
	TransportId              string    `json:"transportId,omitempty"`
	Timestamp                int64     `json:"timestamp,omitempty"`
	SctpState                SctpState `json:"sctpState,omitempty"`
	BytesReceived            int64     `json:"bytesReceived,omitempty"`
	RecvBitrate              int64     `json:"recvBitrate,omitempty"`
	BytesSent                int64     `json:"bytesSent,omitempty"`
	SendBitrate              int64     `json:"sendBitrate,omitempty"`
	RtpBytesReceived         int64     `json:"rtpBytesReceived,omitempty"`
	RtpRecvBitrate           int64     `json:"rtpRecvBitrate,omitempty"`
	RtpBytesSent             int64     `json:"rtpBytesSent,omitempty"`
	RtpSendBitrate           int64     `json:"rtpSendBitrate,omitempty"`
	RtxBytesReceived         int64     `json:"rtxBytesReceived,omitempty"`
	RtxRecvBitrate           int64     `json:"rtxRecvBitrate,omitempty"`
	RtxBytesSent             int64     `json:"rtxBytesSent,omitempty"`
	RtxSendBitrate           int64     `json:"rtxSendBitrate,omitempty"`
	ProbationBytesSent       int64     `json:"probationBytesSent,omitempty"`
	ProbationSendBitrate     int64     `json:"probationSendBitrate,omitempty"`
	AvailableOutgoingBitrate int64     `json:"availableOutgoingBitrate,omitempty"`
	AvailableIncomingBitrate int64     `json:"availableIncomingBitrate,omitempty"`
	MaxIncomingBitrate       int64     `json:"maxIncomingBitrate,omitempty"`
	RtpPacketLossReceived    float64   `json:"rtpPacketLossReceived,omitempty"`
	RtpPacketLossSent        float64   `json:"rtpPacketLossSent,omitempty"`

	*WebRtcTransportSpecificStat
}

type TransportTraceEventType

type TransportTraceEventType string
const (
	TransportTraceEventType_Probation TransportTraceEventType = "probation"
	TransportTraceEventType_Bwe       TransportTraceEventType = "bwe"
)

type TransportTuple

type TransportTuple struct {
	LocalIp    string `json:"localIp,omitempty"`
	LocalPort  uint16 `json:"localPort,omitempty"`
	RemoteIp   string `json:"remoteIp,omitempty"`
	RemotePort uint16 `json:"remotePort,omitempty"`
	Protocol   string `json:"protocol,omitempty"`
}

type TransportType

type TransportType string
const (
	TransportType_Direct TransportType = "DirectTransport"
	TransportType_Plain  TransportType = "PlainTransport"
	TransportType_Pipe   TransportType = "PipeTransport"
	TransportType_Webrtc TransportType = "WebrtcTransport"
)

type TypeError

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

func (TypeError) Error

func (e TypeError) Error() string

type UnsupportedError

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

UnsupportedError indicating not support for something.

func (UnsupportedError) Error

func (e UnsupportedError) Error() string

type WebRtcTransportDump

type WebRtcTransportDump struct {
	IceRole          string         `json:"iceRole,omitempty"`
	IceParameters    IceParameters  `json:"iceParameters,omitempty"`
	IceCandidates    []IceCandidate `json:"iceCandidates,omitempty"`
	IceState         IceState       `json:"iceState,omitempty"`
	IceSelectedTuple TransportTuple `json:"iceSelectedTuple,omitempty"`
	DtlsParameters   DtlsParameters `json:"dtlsParameters,omitempty"`
	DtlsState        DtlsState      `json:"dtlsState,omitempty"`
	DtlsRemoteCert   string         `json:"dtlsRemoteCert,omitempty"`
}

type WebRtcTransportOptions

type WebRtcTransportOptions struct {
	/**
	 * Listening IP address or addresses in order of preference (first one is the
	 * preferred one).
	 */
	ListenIps []TransportListenIp `json:"listenIps,omitempty"`

	/**
	 * Listen in UDP. Default true.
	 */
	EnableUdp *bool `json:"enableUdp,omitempty"`

	/**
	 * Listen in TCP. Default false.
	 */
	EnableTcp bool `json:"enableTcp,omitempty"`

	/**
	 * Prefer UDP. Default false.
	 */
	PreferUdp bool `json:"preferUdp,omitempty"`

	/**
	 * Prefer TCP. Default false.
	 */
	PreferTcp bool `json:"preferTcp,omitempty"`

	/**
	 * Initial available outgoing bitrate (in bps). Default 600000.
	 */
	InitialAvailableOutgoingBitrate uint32 `json:"initialAvailableOutgoingBitrate,omitempty"`

	SctpOptions
	/**
	 * Custom application data.
	 */
	AppData interface{} `json:"appData,omitempty"`
}

type WebRtcTransportSpecificStat

type WebRtcTransportSpecificStat struct {
	IceRole          string          `json:"iceRole"`
	IceState         IceState        `json:"iceState"`
	DtlsState        DtlsRole        `json:"dtlsState"`
	IceSelectedTuple *TransportTuple `json:"iceSelectedTuple,omitempty"`
}

type WebrtcTransportData added in v1.0.7

type WebrtcTransportData struct {
	// always be 'controlled'
	IceRole          string         `json:"iceRole,omitempty"`
	IceParameters    IceParameters  `json:"iceParameters,omitempty"`
	IceCandidates    []IceCandidate `json:"iceCandidates,omitempty"`
	IceState         IceState       `json:"iceState,omitempty"`
	IceSelectedTuple TransportTuple `json:"iceSelectedTuple,omitempty"`
	DtlsParameters   DtlsParameters `json:"dtlsParameters,omitempty"`
	DtlsState        DtlsState      `json:"dtlsState,omitempty"`
	DtlsRemoteCert   string         `json:"dtlsRemoteCert,omitempty"`
	SctpParameters   SctpParameters `json:"sctpParameters,omitempty"`
	SctpState        SctpState      `json:"sctpState,omitempty"`
}

type WorkerDump

type WorkerDump struct {
	Pid       int      `json:"pid,omitempty"`
	RouterIds []string `json:"routerIds,omitempty"`
}

type WorkerLogLevel

type WorkerLogLevel string
const (
	WorkerLogLevel_Trace WorkerLogLevel = "trace"
	WorkerLogLevel_Debug WorkerLogLevel = "debug"
	WorkerLogLevel_Info  WorkerLogLevel = "info"
	WorkerLogLevel_Warn  WorkerLogLevel = "warn"
	WorkerLogLevel_Error WorkerLogLevel = "error"
	WorkerLogLevel_None  WorkerLogLevel = "none"
)

type WorkerLogTag

type WorkerLogTag string
const (
	WorkerLogTag_INFO      WorkerLogTag = "info"
	WorkerLogTag_ICE       WorkerLogTag = "ice"
	WorkerLogTag_DTLS      WorkerLogTag = "dtls"
	WorkerLogTag_RTP       WorkerLogTag = "rtp"
	WorkerLogTag_SRTP      WorkerLogTag = "srtp"
	WorkerLogTag_RTCP      WorkerLogTag = "rtcp"
	WorkerLogTag_RTX       WorkerLogTag = "rtx"
	WorkerLogTag_BWE       WorkerLogTag = "bwe"
	WorkerLogTag_Score     WorkerLogTag = "score"
	WorkerLogTag_Simulcast WorkerLogTag = "simulcast"
	WorkerLogTag_SVC       WorkerLogTag = "svc"
	WorkerLogTag_SCTP      WorkerLogTag = "sctp"
	WorkerLogTag_Message   WorkerLogTag = "message"
)

type WorkerResourceUsage

type WorkerResourceUsage struct {
	/**
	 * User CPU time used (in ms).
	 */
	RU_Utime int64 `json:"ru_utime"`

	/**
	 * System CPU time used (in ms).
	 */
	RU_Stime int64 `json:"ru_stime"`

	/**
	 * Maximum resident set size.
	 */
	RU_Maxrss int64 `json:"ru_maxrss"`

	/**
	 * Integral shared memory size.
	 */
	RU_Ixrss int64 `json:"ru_ixrss"`

	/**
	 * Integral unshared data size.
	 */
	RU_Idrss int64 `json:"ru_idrss"`

	/**
	 * Integral unshared stack size.
	 */
	RU_Isrss int64 `json:"ru_isrss"`

	/**
	 * Page reclaims (soft page faults).
	 */
	RU_Minflt int64 `json:"ru_minflt"`

	/**
	 * Page faults (hard page faults).
	 */
	RU_Majflt int64 `json:"ru_majflt"`

	/**
	 * Swaps.
	 */
	RU_Nswap int64 `json:"ru_nswap"`

	/**
	 * Block input operations.
	 */
	RU_Inblock int64 `json:"ru_inblock"`

	/**
	 * Block output operations.
	 */
	RU_Oublock int64 `json:"ru_oublock"`

	/**
	 * IPC messages sent.
	 */
	RU_Msgsnd int64 `json:"ru_msgsnd"`

	/**
	 * IPC messages received.
	 */
	RU_Msgrcv int64 `json:"ru_msgrcv"`

	/**
	 * Signals received.
	 */
	RU_Nsignals int64 `json:"ru_nsignals"`

	/**
	 * Voluntary context switches.
	 */
	RU_Nvcsw int64 `json:"ru_nvcsw"`

	/**
	 * Involuntary context switches.
	 */
	RU_Nivcsw int64 `json:"ru_nivcsw"`
}

*

  • An object with the fields of the uv_rusage_t struct. *
  • - http//docs.libuv.org/en/v1.x/misc.html#c.uv_rusage_t
  • - https//linux.die.net/man/2/getrusage

type WorkerSettings

type WorkerSettings struct {
	/**
	 * Logging level for logs generated by the media worker subprocesses (check
	 * the Debugging documentation). Valid values are 'debug', 'warn', 'error' and
	 * 'none'. Default 'error'.
	 */
	LogLevel WorkerLogLevel `json:"logLevel,omitempty"`

	/**
	 * Log tags for debugging. Check the meaning of each available tag in the
	 * Debugging documentation.
	 */
	LogTags []WorkerLogTag `json:"logTags,omitempty"`

	/**
	 * Minimun RTC port for ICE, DTLS, RTP, etc. Default 10000.
	 */
	RtcMinPort uint16 `json:"rtcMinPort,omitempty"`

	/**
	 * Maximum RTC port for ICE, DTLS, RTP, etc. Default 59999.
	 */
	RtcMaxPort uint16 `json:"rtcMaxPort,omitempty"`

	// mux port
	RtcStaticPort uint16 `json:"rtcStaticPort,omitempty"`
	RtcListenIp   string `json:"rtcListenIp,omitempty"`

	/**
	 * Path to the DTLS public certificate file in PEM format. If unset, a
	 * certificate is dynamically created.
	 */
	DtlsCertificateFile string `json:"dtlsCertificateFile,omitempty"`

	/**
	 * Path to the DTLS certificate private key file in PEM format. If unset, a
	 * certificate is dynamically created.
	 */
	DtlsPrivateKeyFile string `json:"dtlsPrivateKeyFile,omitempty"`

	PrometheusPath string `json:"prometheusPath,omitempty"`
	PrometheusPort int    `json:"prometheusPort,omitempty"`

	PipePort int `json:"pipePort,omitempty"`

	ReceiveMTU uint32 `json:"receiveMTU,omitempty"`
	/**
	 * Custom application data.
	 */
	AppData interface{} `json:"appData,omitempty"`

	/**
	 * Custom options.
	 */
	CustomOptions map[string]interface{}
}

type WorkerUpdateableSettings

type WorkerUpdateableSettings struct {
	/**
	 * Logging level for logs generated by the media worker subprocesses (check
	 * the Debugging documentation). Valid values are 'debug', 'warn', 'error' and
	 * 'none'. Default 'error'.
	 */
	LogLevel WorkerLogLevel `json:"logLevel,omitempty"`

	/**
	 * Log tags for debugging. Check the meaning of each available tag in the
	 * Debugging documentation.
	 */
	LogTags []WorkerLogTag `json:"logTags,omitempty"`
}

Jump to

Keyboard shortcuts

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