Documentation Index
Fetch the complete documentation index at: https://mintlify.com/pion/webrtc/llms.txt
Use this file to discover all available pages before exploring further.
Overview
RTPReceiver allows an application to inspect the receipt of a TrackRemote. It manages inbound RTP streams including demuxing, RTCP feedback, and support for simulcast and RTX.Type Definition
Constructor
NewRTPReceiver
Constructs a new RTPReceiver.The codec type (audio or video)
The DTLS transport to use for receiving
The newly created RTPReceiver
Returns error if transport is nil
Methods
Transport
Returns the currently-configured DTLSTransport or nil if one has not yet been configured.The associated DTLS transport
GetParameters
Describes the current configuration for the encoding and transmission of media on the receiver’s track.The current receive parameters including codecs and header extensions
Track
Returns the RTPReceiver’s TrackRemote.The remote track, or nil if there are multiple tracks (simulcast)
For simulcast streams with multiple tracks, use the
Tracks() method instead.Tracks
Returns the RTPReceiver tracks. An RTPReceiver may have multiple tracks to support Simulcast.All remote tracks associated with this receiver
RTPTransceiver
Returns the RTPTransceiver this RTPReceiver belongs to, or nil if none.The associated transceiver
Receive
Initializes the track and starts all the transports.The receive parameters to configure
Returns error if:
- Receive already called
- Track stream not found for SSRC
- Stream initialization fails
Read
Reads incoming RTCP for this RTPReceiver.Buffer to read RTCP data into
Number of bytes read
Interceptor attributes associated with the packet
Returns error if read fails or receiver is closed
ReadRTCP
A convenience method that wraps Read and unmarshal for you. It also runs any configured interceptors.The unmarshaled RTCP packets
Interceptor attributes
Returns error if read or unmarshal fails
ReadSimulcast
Reads incoming RTCP for this RTPReceiver for given RID.Buffer to read RTCP data into
The RTP stream identifier to read RTCP for
Returns error if track stream not found for RID
ReadSimulcastRTCP
A convenience method that wraps ReadSimulcast and unmarshal for you.The RTP stream identifier
Stop
Irreversibly stops the RTPReceiver.Returns error if stopping fails
Stopping a receiver closes all associated RTP and RTCP streams and unbinds all interceptors.
SetReadDeadline
Sets the max amount of time the RTCP stream will block before returning. 0 is forever.The deadline time. Zero value means no deadline.
SetReadDeadlineSimulcast
Sets the max amount of time the RTCP stream for a given RID will block before returning. 0 is forever.The deadline time
The RTP stream identifier
Returns error if track stream not found for RID
Usage Examples
Handling Incoming Tracks
Reading RTCP Feedback
Handling Simulcast Tracks
Using RTX (Retransmission)
See Also
- RTPSender - Manages outbound RTP streams
- RTPTransceiver - Combines sender and receiver
- TrackRemote - Remote media track