Documentation
¶
Index ¶
- Variables
- type Configuration
- type PayloadType
- type PeerConnection
- type RTPCodecCapability
- type RTPCodecKind
- type RTPParameters
- type RTPReceiver
- type RTPSender
- type RTPTransceiver
- type RTPTransceiverDirection
- type RTPTransceiverInit
- type SSRC
- type SettingEngine
- type TrackLocal
- type TrackLocalContext
- type TrackLocalWriter
- type TrackRemote
Constants ¶
This section is empty.
Variables ¶
var ( // ErrIncompatible is an internal error returned from TrackLocal/RemoteAdapter. ErrIncompatible = errors.New("incompatible pair of Track and RTPSender/Receiver") )
Functions ¶
This section is empty.
Types ¶
type Configuration ¶
type Configuration struct{}
A Configuration defines how peer-to-peer communication via PeerConnection is established or re-established. Configurations may be set up once and reused across multiple connections. Configurations are treated as readonly. As long as they are unmodified, they are safe for concurrent use.
type PayloadType ¶
type PayloadType uint8
PayloadType is used to indicate the Payload format PayloadType type is used to identify an individual codec they are dynamic and determined by the offerer
type PeerConnection ¶
type PeerConnection interface { // AddTransceiverFromTrack creates a new RTPTransceiver from TrackLocal // and register it to the PeerConnection. // Pass nil as a second argument to use default setting. // Returned RTPTransceiver will be sendrecv by default. // // ref: https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/addTransceiver AddTransceiverFromTrack(TrackLocal, *RTPTransceiverInit) (RTPTransceiver, error) // AddTransceiverFromKind creates a new RTPTransceiver from RTPCodecType // and register it to the PeerConnection. // Pass nil as a second argument to use default setting. // Returned RTPTransceiver will be sendrecv by default. // // ref: https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/addTransceiver AddTransceiverFromKind(RTPCodecKind, *RTPTransceiverInit) (RTPTransceiver, error) // OnTrack handles an incoming media feed. // // ref: https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/ontrack OnTrack(func(TrackRemote, RTPReceiver)) }
PeerConnection represents RTCPeerConnection.
func NewPeerConnection ¶
func NewPeerConnection(c Configuration) (PeerConnection, error)
NewPeerConnection creates a new WebRTC PeerConnection. This uses a uninitialized SettingEngine. If you wish to access any Pion specific behaviors you should create a PeerConnection using `NewPeerConnection` method of the SettingEngine
type RTPCodecCapability ¶
type RTPCodecCapability struct { PreferredPayloadType PayloadType MimeType string ClockRate int Channels int SdpFmtpLine string }
RTPCodecCapability is the configuration for one RTPCodec
type RTPCodecKind ¶
type RTPCodecKind int
const ( RTPCodecKindVideo RTPCodecKind = iota + 1 RTPCodecKindAudio )
type RTPParameters ¶
type RTPParameters struct { SSRC SSRC SelectedCodec *RTPCodecCapability Codecs []RTPCodecCapability }
RTPParameters represents RTCRtpParameters which contains information about how the RTC data is to be encoded/decoded.
ref: https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpSendParameters
type RTPReceiver ¶
type RTPReceiver interface { // Track returns associated TrackRemote. Track() TrackRemote // Parameters returns information about how the data is to be decoded. Parameters() RTPParameters }
RTPReceiver represents RTCRtpReceiver.
type RTPSender ¶
type RTPSender interface { // ReplaceTrackLocal registers given TrackLocal as a source of RTP packets. ReplaceTrack(TrackLocal) error // Track returns currently bound TrackLocal. Track() TrackLocal // Parameters returns information about how the data is to be encoded. Parameters() RTPParameters // SetParameters sets information about how the data is to be encoded. // This will be called by PeerConnection according to the result of // SDP based negotiation. SetParameters(RTPParameters) error }
RTPSender represents RTCRtpSender.
type RTPTransceiver ¶
type RTPTransceiver interface { RTPSender() RTPSender RTPReceiver() RTPReceiver }
RTPTransceiver represents RTCRtpTransceiver. It represents a combination of an RTCRtpSender and an RTCRtpReceiver that share a common mid.
ref: https://www.w3.org/TR/webrtc/#rtcrtptransceiver-interface
type RTPTransceiverDirection ¶
type RTPTransceiverDirection int
RTPTransceiverDirection indicates the direction of the RTPTransceiver.
const ( // RTPTransceiverDirectionSendrecv indicates the RTPSender will offer // to send RTP and RTPReceiver the will offer to receive RTP. RTPTransceiverDirectionSendrecv RTPTransceiverDirection = iota + 1 // RTPTransceiverDirectionSendonly indicates the RTPSender will offer // to send RTP. RTPTransceiverDirectionSendonly // RTPTransceiverDirectionRecvonly indicates the RTPReceiver the will // offer to receive RTP. RTPTransceiverDirectionRecvonly // RTPTransceiverDirectionInactive indicates the RTPSender won't offer // to send RTP and RTPReceiver the won't offer to receive RTP. RTPTransceiverDirectionInactive )
type RTPTransceiverInit ¶
type RTPTransceiverInit struct { Direction RTPTransceiverDirection SendEncodings []RTPParameters }
RTPTransceiverInit represents RTCRtpTransceiverInit dictionary.
type SettingEngine ¶
type SettingEngine struct{}
func (*SettingEngine) NewPeerConnection ¶
func (s *SettingEngine) NewPeerConnection(Configuration) (PeerConnection, error)
NewPeerConnection creates a NewPeerConnection
func (*SettingEngine) SetEncodings ¶
func (s *SettingEngine) SetEncodings([]*RTPCodecCapability) error
SetEncodings configures the codecs the newly created PeerConnection is willing to send and receive. If nothing is configured it will support everything that Pion WebRTC implements packetization for.
type TrackLocal ¶
type TrackLocal interface { // Bind should implement the way how the media data flows from the Track to the PeerConnection // This will be called internally after signaling is complete and the list of available // codecs has been determined Bind(TrackLocalContext) error // Unbind should implement the teardown logic when the track is no longer needed. This happens // because a track has been stopped. Unbind(TrackLocalContext) error // ID is the unique identifier for this Track. This should be unique for the // stream, but doesn't have to globally unique. A common example would be 'audio' or 'video' // and StreamID would be 'desktop' or 'webcam' ID() string // StreamID is the group this track belongs too. This must be unique StreamID() string }
TrackLocal is an interface that controls how the user can send media The user can provide their own TrackLocal implementatiosn, or use the implementations in pkg/media
type TrackLocalContext ¶
type TrackLocalContext struct{}
TrackLocalContext is the Context passed when a TrackLocal has been Binded/Unbinded from a PeerConnection
func (*TrackLocalContext) Parameters ¶
func (t *TrackLocalContext) Parameters() RTPParameters
Parameters returns the negotiated Parameters. These are the codecs supported by both PeerConnections and the SSRC/PayloadTypes
func (*TrackLocalContext) WriteStream ¶
func (t *TrackLocalContext) WriteStream() TrackLocalWriter
WriteStream returns the WriteStream for this TrackLocal. The implementer writes the outbound media packets to it
type TrackLocalWriter ¶
type TrackLocalWriter interface { // WriteRTP encrypts a RTP packet and writes to the connection WriteRTP(header *rtp.Header, payload []byte) (int, error) // Write encrypts and writes a full RTP packet Write(b []byte) (int, error) }
TrackLocalWriter is the Writer for outbound RTP Packets
type TrackRemote ¶
type TrackRemote struct{}
Track represents a single media track from a remote peer
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
pkg
|
|
media
Package media provides media writer and filters
|
Package media provides media writer and filters |
media/ivfreader
Package ivfreader implements IVF media container reader
|
Package ivfreader implements IVF media container reader |