WebRTC media transport via libdatachannel; peer sessions, media bridge, codec negotiation.
| Name | Description |
|---|---|
SignallingInterface | Transport-agnostic signalling interface for WebRTC session setup. |
MediaBridge | Convenience wrapper that creates WebRTC tracks on a PeerConnection and exposes per-track sender/receiver adapters for PacketStream integration. |
PeerSession | Manages a WebRTC peer connection lifecycle over any signalling transport that implements SignallingInterface. |
WebRtcTrackSender | PacketProcessor that sends encoded media to a single libdatachannel Track via sendFrame(). |
WebRtcTrackReceiver | PacketStreamAdapter that receives depacketized frames from a single remote libdatachannel Track and emits them as VideoPacket or AudioPacket into a PacketStream. |
CodecNegotiator | Maps RTP codec names to FFmpeg encoders and queries FFmpeg at runtime to determine what codecs are available. |
TrackHandle | Result of creating a track: the track itself plus its RTP config. Keep the config around - you need it for WebRtcTrackSender. |
CodecSpec | Canonical description of a codec supported by icey's WebRTC helpers. |
NegotiatedCodec | Result of codec negotiation between a remote SDP offer and the local FFmpeg codec inventory. |
| Name | Description |
|---|---|
CodecMediaType | Whether a codec carries audio or video media. |
CodecId | Stable codec identifiers used across negotiation and track setup. |
enum CodecMediaTypeWhether a codec carries audio or video media.
| Value | Description |
|---|---|
Video | Video RTP payload. |
Audio | Audio RTP payload. |
enum CodecIdStable codec identifiers used across negotiation and track setup.
| Value | Description |
|---|---|
Unknown | Unrecognized or unsupported codec. |
H264 | H.264 / AVC. |
H265 | H.265 / HEVC. |
VP8 | Google VP8. |
VP9 | Google VP9. |
AV1 | AOMedia AV1. |
Opus | Opus audio. |
PCMU | G.711 mu-law audio. |
PCMA | G.711 A-law audio. |
G722 | G.722 wideband audio. |
AAC | AAC audio. |
| Return | Name | Description |
|---|---|---|
TrackHandle | createVideoTrack | Create a video send track on a PeerConnection. |
TrackHandle | createAudioTrack | Create an audio send track on a PeerConnection. |
std::shared_ptr< rtc::Track > | createVideoReceiveTrack | Create a pure receive-side video track on a PeerConnection. |
std::shared_ptr< rtc::Track > | createAudioReceiveTrack | Create a pure receive-side audio track on a PeerConnection. |
bool | setupReceiveTrack | Set up the receive-side media handler chain on a remote track. |
uint32_t | generateSsrc | Generate a random SSRC. |
const char * | stateToString | Convert a PeerSession::State to a lowercase C string for logging. |
TrackHandle createVideoTrack(std::shared_ptr< rtc::PeerConnection > pc, const av::VideoCodec & codec, uint32_t ssrc, const std::string & cname, const std::string & mid, rtc::Description::Direction direction, unsigned nackBuffer, std::function< void()> onPli, std::function< void(unsigned int)> onRemb, int payloadType)Create a video send track on a PeerConnection.
Sets up the full outgoing media handler chain: Packetizer → SrReporter → NackResponder → PliHandler → RembHandler
The packetizer is selected based on the codec: H264 → H264RtpPacketizer (Annex-B long start sequence) H265 → H265RtpPacketizer (Annex-B long start sequence) VP8/VP9/other → generic RtpPacketizer
pc PeerConnection to add the track to.
codec Video codec. Must name a supported RTP codec or FFmpeg encoder (e.g. "H264" or "libx264").
ssrc RTP SSRC. 0 = auto-generate.
cname RTCP CNAME. Empty = "icey".
mid MID to use for the track when answering an existing offer.
direction Direction to advertise for the negotiated m-line.
nackBuffer Max packets stored for NACK retransmission.
onPli Callback when remote peer requests a keyframe. Connect to your encoder to force IDR.
onRemb Callback when remote peer reports bandwidth estimate. Bitrate in bits/sec.
payloadType Explicit RTP payload type to reuse when answering an offer. -1 = use the codec's default/preferred type.
TrackHandle with the track and its RTP config.
TrackHandle createAudioTrack(std::shared_ptr< rtc::PeerConnection > pc, const av::AudioCodec & codec, uint32_t ssrc, const std::string & cname, const std::string & mid, rtc::Description::Direction direction, int payloadType)Create an audio send track on a PeerConnection.
Sets up the outgoing media handler chain: AudioRtpPacketizer → SrReporter
The packetizer clock rate is selected based on codec: opus → 48kHz, PCMU/PCMA → 8kHz, etc.
pc PeerConnection to add the track to.
codec Audio codec. Must name a supported RTP codec or FFmpeg encoder (e.g. "opus" or "libopus").
ssrc RTP SSRC. 0 = auto-generate.
cname RTCP CNAME. Empty = "icey".
mid MID to use for the track when answering an existing offer.
direction Direction to advertise for the negotiated m-line.
payloadType Explicit RTP payload type to reuse when answering an offer. -1 = use the codec's default/preferred type.
TrackHandle with the track and its RTP config.
std::shared_ptr< rtc::Track > createVideoReceiveTrack(std::shared_ptr< rtc::PeerConnection > pc, const av::VideoCodec & codec, const std::string & mid, rtc::Description::Direction direction, int payloadType)Create a pure receive-side video track on a PeerConnection.
Unlike createVideoTrack(), this does not add a local SSRC or sender packetizer chain. It is for answers that only receive remote media.
std::shared_ptr< rtc::Track > createAudioReceiveTrack(std::shared_ptr< rtc::PeerConnection > pc, const av::AudioCodec & codec, const std::string & mid, rtc::Description::Direction direction, int payloadType)Create a pure receive-side audio track on a PeerConnection.
Unlike createAudioTrack(), this does not add a local SSRC or sender packetizer chain. It is for answers that only receive remote media.
bool setupReceiveTrack(std::shared_ptr< rtc::Track > track)Set up the receive-side media handler chain on a remote track.
Selects the correct depacketizer based on the track's SDP codec: Video: H264RtpDepacketizer, H265RtpDepacketizer, or generic Audio: OpusRtpDepacketizer, PCMURtpDepacketizer, etc.
Also chains an RtcpReceivingSession for receiver reports.
Call this from PeerConnection::onTrack() before binding a WebRtcTrackReceiver.
track The remote track from onTrack callback.True when a supported depacketizer was installed.
uint32_t generateSsrc()Generate a random SSRC.
const char * stateToString(PeerSession::State state)Convert a PeerSession::State to a lowercase C string for logging.
state State value to convert.One of: "idle", "outgoing-init", "incoming-init", "negotiating", "active", "ending", "ended".