Source File
track_local.go
Belonging Package
github.com/pion/webrtc/v4
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>// SPDX-License-Identifier: MITpackage webrtcimport ()// TrackLocalWriter is the Writer for outbound RTP Packets.type TrackLocalWriter interface {// WriteRTP encrypts a RTP packet and writes to the connectionWriteRTP(header *rtp.Header, payload []byte) (int, error)// Write encrypts and writes a full RTP packetWrite(b []byte) (int, error)}// TrackLocalContext is the Context passed when a TrackLocal has been Binded/Unbinded from a PeerConnection, and used// in Interceptors.type TrackLocalContext interface {// CodecParameters returns the negotiated RTPCodecParameters. These are the codecs supported by both// PeerConnections and the PayloadTypesCodecParameters() []RTPCodecParameters// HeaderExtensions returns the negotiated RTPHeaderExtensionParameters. These are the header extensions supported by// both PeerConnections and the URI/IDsHeaderExtensions() []RTPHeaderExtensionParameter// SSRC returns the negotiated SSRC of this trackSSRC() SSRC// SSRCRetransmission returns the negotiated SSRC used to send retransmissions for this trackSSRCRetransmission() SSRC// SSRCForwardErrorCorrection returns the negotiated SSRC to send forward error correction for this trackSSRCForwardErrorCorrection() SSRC// WriteStream returns the WriteStream for this TrackLocal. The implementer writes the outbound// media packets to itWriteStream() TrackLocalWriter// ID is a unique identifier that is used for both Bind/UnbindID() string// RTCPReader returns the RTCP interceptor for this TrackLocal. Used to read RTCP of this TrackLocal.RTCPReader() interceptor.RTCPReader}type baseTrackLocalContext struct {id stringparams RTPParametersssrc, ssrcRTX, ssrcFEC SSRCwriteStream TrackLocalWriterrtcpInterceptor interceptor.RTCPReader}// CodecParameters returns the negotiated RTPCodecParameters. These are the codecs supported by both// PeerConnections and the SSRC/PayloadTypes.func ( *baseTrackLocalContext) () []RTPCodecParameters {return .params.Codecs}// HeaderExtensions returns the negotiated RTPHeaderExtensionParameters. These are the header extensions supported by// both PeerConnections and the SSRC/PayloadTypes.func ( *baseTrackLocalContext) () []RTPHeaderExtensionParameter {return .params.HeaderExtensions}// SSRC requires the negotiated SSRC of this track.func ( *baseTrackLocalContext) () SSRC {return .ssrc}// SSRCRetransmission returns the negotiated SSRC used to send retransmissions for this track.func ( *baseTrackLocalContext) () SSRC {return .ssrcRTX}// SSRCForwardErrorCorrection returns the negotiated SSRC to send forward error correction for this track.func ( *baseTrackLocalContext) () SSRC {return .ssrcFEC}// WriteStream returns the WriteStream for this TrackLocal. The implementer writes the outbound// media packets to it.func ( *baseTrackLocalContext) () TrackLocalWriter {return .writeStream}// ID is a unique identifier that is used for both Bind/Unbind.func ( *baseTrackLocalContext) () string {return .id}// RTCPReader returns the RTCP interceptor for this TrackLocal. Used to read RTCP of this TrackLocal.func ( *baseTrackLocalContext) () interceptor.RTCPReader {return .rtcpInterceptor}// TrackLocal is an interface that controls how the user can send media// The user can provide their own TrackLocal implementations, or use// the implementations in pkg/media.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 determinedBind(TrackLocalContext) (RTPCodecParameters, 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// RID is the RTP Stream ID for this track.RID() string// StreamID is the group this track belongs too. This must be uniqueStreamID() string// Kind controls if this TrackLocal is audio or videoKind() RTPCodecType}
![]() |
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. |