webrtc

May 15, 2026 · View on GitHub

{#webrtcmodule}

webrtc

WebRTC media transport via libdatachannel; peer sessions, media bridge, codec negotiation.

Classes

NameDescription
SignallingInterfaceTransport-agnostic signalling interface for WebRTC session setup.
MediaBridgeConvenience wrapper that creates WebRTC tracks on a PeerConnection and exposes per-track sender/receiver adapters for PacketStream integration.
PeerSessionManages a WebRTC peer connection lifecycle over any signalling transport that implements SignallingInterface.
WebRtcTrackSenderPacketProcessor that sends encoded media to a single libdatachannel Track via sendFrame().
WebRtcTrackReceiverPacketStreamAdapter that receives depacketized frames from a single remote libdatachannel Track and emits them as VideoPacket or AudioPacket into a PacketStream.
CodecNegotiatorMaps RTP codec names to FFmpeg encoders and queries FFmpeg at runtime to determine what codecs are available.
TrackHandleResult of creating a track: the track itself plus its RTP config. Keep the config around - you need it for WebRtcTrackSender.
JitterBufferConfigReceive-side jitter buffer behaviour for depacketized WebRTC media frames.
CodecSpecCanonical description of a codec supported by icey's WebRTC helpers.
NegotiatedCodecResult of codec negotiation between a remote SDP offer and the local FFmpeg codec inventory.

Enumerations

NameDescription
CodecMediaTypeWhether a codec carries audio or video media.
CodecIdStable codec identifiers used across negotiation and track setup.

{#codecmediatype}

CodecMediaType

enum CodecMediaType

Whether a codec carries audio or video media.

ValueDescription
VideoVideo RTP payload.
AudioAudio RTP payload.

{#codecid}

CodecId

enum CodecId

Stable codec identifiers used across negotiation and track setup.

ValueDescription
UnknownUnrecognized or unsupported codec.
H264H.264 / AVC.
H265H.265 / HEVC.
VP8Google VP8.
VP9Google VP9.
AV1AOMedia AV1.
OpusOpus audio.
PCMUG.711 mu-law audio.
PCMAG.711 A-law audio.
G722G.722 wideband audio.
AACAAC audio.

Functions

ReturnNameDescription
TrackHandlecreateVideoTrack nodiscardCreate a video send track on a PeerConnection.
TrackHandlecreateAudioTrack nodiscardCreate an audio send track on a PeerConnection.
std::shared_ptr< rtc::Track >createVideoReceiveTrack nodiscardCreate a pure receive-side video track on a PeerConnection.
std::shared_ptr< rtc::Track >createAudioReceiveTrack nodiscardCreate a pure receive-side audio track on a PeerConnection.
boolsetupReceiveTrack nodiscardSet up the receive-side media handler chain on a remote track.
uint32_tgenerateSsrc nodiscardGenerate a random SSRC.
const char *stateToString nodiscardConvert a PeerSession::State to a lowercase C string for logging.

{#createvideotrack}

createVideoTrack

nodiscard

[[nodiscard]] TrackHandle createVideoTrack(std::shared_ptr< rtc::PeerConnection > pc, const av::VideoCodec & codec, uint32_t ssrc = 0, const std::string & cname = {}, const std::string & mid = {}, rtc::Description::Direction direction = rtc::Description::Direction::SendRecv, unsigned nackBuffer = 512, std::function< void()> onPli = nullptr, std::function< void(unsigned int)> onRemb = nullptr, int payloadType = -1)

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

Parameters

  • 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.

Returns

TrackHandle with the track and its RTP config.


{#createaudiotrack}

createAudioTrack

nodiscard

[[nodiscard]] TrackHandle createAudioTrack(std::shared_ptr< rtc::PeerConnection > pc, const av::AudioCodec & codec, uint32_t ssrc = 0, const std::string & cname = {}, const std::string & mid = {}, rtc::Description::Direction direction = rtc::Description::Direction::SendRecv, int payloadType = -1)

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.

Parameters

  • 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.

Returns

TrackHandle with the track and its RTP config.


{#createvideoreceivetrack}

createVideoReceiveTrack

nodiscard

[[nodiscard]] std::shared_ptr< rtc::Track > createVideoReceiveTrack(std::shared_ptr< rtc::PeerConnection > pc, const av::VideoCodec & codec, const std::string & mid = {}, rtc::Description::Direction direction = rtc::Description::Direction::RecvOnly, int payloadType = -1)

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.


{#createaudioreceivetrack}

createAudioReceiveTrack

nodiscard

[[nodiscard]] std::shared_ptr< rtc::Track > createAudioReceiveTrack(std::shared_ptr< rtc::PeerConnection > pc, const av::AudioCodec & codec, const std::string & mid = {}, rtc::Description::Direction direction = rtc::Description::Direction::RecvOnly, int payloadType = -1)

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.


{#setupreceivetrack}

setupReceiveTrack

nodiscard

[[nodiscard]] 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.

Parameters

  • track The remote track from onTrack callback.

Returns

True when a supported depacketizer was installed.


{#generatessrc}

generateSsrc

nodiscard

[[nodiscard]] uint32_t generateSsrc()

Generate a random SSRC.


{#statetostring}

stateToString

nodiscard

[[nodiscard]] const char * stateToString(PeerSession::State state)

Convert a PeerSession::State to a lowercase C string for logging.

Parameters

  • state State value to convert.

Returns

One of: "idle", "outgoing-init", "incoming-init", "negotiating", "active", "ending", "ended".

{#signallinginterface}

SignallingInterface

#include <icy/webrtc/signalling.h>
class SignallingInterface

Defined in src/webrtc/include/icy/webrtc/signalling.h:38

Subclassed by: SympleServerSignaller, SympleSignaller, WebSocketSignaller

Transport-agnostic signalling interface for WebRTC session setup.

Implementations handle the exchange of SDP offers/answers and ICE candidates between peers over whatever transport is available: Symple, plain WebSocket, REST, MQTT, carrier pigeon, etc.

PeerSession takes a reference to this interface. Implement it to plug in your own signalling backend.

The three message categories:

  • SDP: offer/answer exchange (the session description)

  • Candidate: trickle ICE candidates

  • Control: call lifecycle (init, accept, reject, hangup)

List of all members

NameKindOwner
SdpReceivedvariableDeclared here
CandidateReceivedvariableDeclared here
ControlReceivedvariableDeclared here
sendSdpfunctionDeclared here
sendCandidatefunctionDeclared here
sendControlfunctionDeclared here

Public Attributes

ReturnNameDescription
ThreadSignal< void(const std::string &, const std::string &, const std::string &)>SdpReceivedFires when an SDP offer or answer arrives from a remote peer. Parameters: peerId, type ("offer"/"answer"), sdp.
ThreadSignal< void(const std::string &, const std::string &, const std::string &)>CandidateReceivedFires when an ICE candidate arrives from a remote peer. Parameters: peerId, candidate, mid.
ThreadSignal< void(const std::string &, const std::string &, const std::string &)>ControlReceivedFires when a control message arrives from a remote peer. Parameters: peerId, type ("init"/"accept"/"reject"/"hangup"), reason.

{#sdpreceived}

SdpReceived

ThreadSignal< void(const std::string &, const std::string &, const std::string &)> SdpReceived

Defined in src/webrtc/include/icy/webrtc/signalling.h:77

Fires when an SDP offer or answer arrives from a remote peer. Parameters: peerId, type ("offer"/"answer"), sdp.


{#candidatereceived}

CandidateReceived

ThreadSignal< void(const std::string &, const std::string &, const std::string &)> CandidateReceived

Defined in src/webrtc/include/icy/webrtc/signalling.h:81

Fires when an ICE candidate arrives from a remote peer. Parameters: peerId, candidate, mid.


{#controlreceived}

ControlReceived

ThreadSignal< void(const std::string &, const std::string &, const std::string &)> ControlReceived

Defined in src/webrtc/include/icy/webrtc/signalling.h:85

Fires when a control message arrives from a remote peer. Parameters: peerId, type ("init"/"accept"/"reject"/"hangup"), reason.

Public Methods

ReturnNameDescription
voidsendSdp virtualSend an SDP offer or answer to the remote peer.
voidsendCandidate virtualSend an ICE candidate to the remote peer.
voidsendControl virtualSend a control message to the remote peer.

{#sendsdp}

sendSdp

virtual

virtual void sendSdp(const std::string & peerId, const std::string & type, const std::string & sdp)

Defined in src/webrtc/include/icy/webrtc/signalling.h:51

Send an SDP offer or answer to the remote peer.

Parameters

  • peerId Remote peer identifier.

  • type "offer" or "answer".

  • sdp The SDP string.

Reimplemented by

{#sendcandidate}

sendCandidate

virtual

virtual void sendCandidate(const std::string & peerId, const std::string & candidate, const std::string & mid)

Defined in src/webrtc/include/icy/webrtc/signalling.h:59

Send an ICE candidate to the remote peer.

Parameters

  • peerId Remote peer identifier.

  • candidate The candidate string (from RTCIceCandidate).

  • mid The sdpMid value.

Reimplemented by

{#sendcontrol}

sendControl

virtual

virtual void sendControl(const std::string & peerId, const std::string & type, const std::string & reason = {})

Defined in src/webrtc/include/icy/webrtc/signalling.h:67

Send a control message to the remote peer.

Parameters

  • peerId Remote peer identifier.

  • type Control type: "init", "accept", "reject", "hangup".

  • reason Optional reason string (for reject/hangup).

Reimplemented by

{#mediabridge}

MediaBridge

#include <icy/webrtc/mediabridge.h>
class MediaBridge

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:69

Convenience wrapper that creates WebRTC tracks on a PeerConnection and exposes per-track sender/receiver adapters for PacketStream integration.

For video-only, leave audioCodec default (disabled). For audio-only, leave videoCodec default (disabled). For data-channel-only, don't create a MediaBridge at all.

For full control over individual tracks, use createVideoTrack(), createAudioTrack(), WebRtcTrackSender, and WebRtcTrackReceiver directly instead of this class.

The sender and receiver adapter objects are stable for the lifetime of the MediaBridge. attach() and detach() rebind or unbind the underlying WebRTC tracks without invalidating references previously obtained from videoSender(), audioSender(), videoReceiver(), or audioReceiver().

Example - send camera to browser:

MediaBridge bridge; bridge.attach(pc, {.videoCodec = {"H264", "libx264", 1280, 720, 30}});

PacketStream stream; stream.attachSource(capture); stream.attach(encoder, 1, true); stream.attach(&bridge.videoSender(), 5, false); stream.start();

Example - receive from browser and record:

bridge.videoReceiver().emitter += packetSlot(&recorder, &Recorder::onEncodedVideo);

The receiver emits owning encoded packets. Feed those into a decoder or recorder callback; see samples/media-recorder for a complete example.

List of all members

NameKindOwner
KeyframeRequestedvariableDeclared here
BitrateEstimatevariableDeclared here
MediaBridgefunctionDeclared here
~MediaBridgefunctionDeclared here
MediaBridgefunctionDeclared here
attachfunctionDeclared here
detachfunctionDeclared here
requestKeyframefunctionDeclared here
requestBitratefunctionDeclared here
videoSenderfunctionDeclared here
audioSenderfunctionDeclared here
videoReceiverfunctionDeclared here
audioReceiverfunctionDeclared here
videoTrackfunctionDeclared here
audioTrackfunctionDeclared here
hasVideofunctionDeclared here
hasAudiofunctionDeclared here
attachedfunctionDeclared here
_pcvariableDeclared here
_videoSendervariableDeclared here
_audioSendervariableDeclared here
_videoHandlevariableDeclared here
_audioHandlevariableDeclared here
_videoReceivervariableDeclared here
_audioReceivervariableDeclared here
_videoReceiveTrackvariableDeclared here
_audioReceiveTrackvariableDeclared here
_mutexvariableDeclared here

Public Attributes

ReturnNameDescription
ThreadSignal< void()>KeyframeRequestedRemote peer requests a keyframe. Connect to encoder to force IDR.
ThreadSignal< void(unsigned int)>BitrateEstimateRemote peer reports estimated bandwidth (bits/sec).

{#keyframerequested}

KeyframeRequested

ThreadSignal< void()> KeyframeRequested

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:149

Remote peer requests a keyframe. Connect to encoder to force IDR.


{#bitrateestimate}

BitrateEstimate

ThreadSignal< void(unsigned int)> BitrateEstimate

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:152

Remote peer reports estimated bandwidth (bits/sec).

Public Methods

ReturnNameDescription
MediaBridgeConstruct a detached bridge with stable sender and receiver adapters.
~MediaBridgeDestroy the bridge and release any attached PeerConnection state.
MediaBridgeDeleted copy constructor; MediaBridge owns live track and adapter state.
voidattachCreate tracks on the PeerConnection and set up handler chains. Only creates tracks for codecs with a non-empty encoder name.
voiddetachDetach all tracks and adapters.
voidrequestKeyframeRequest an immediate keyframe (IDR) from the remote sender. Sends a PLI (Picture Loss Indication) RTCP message on the video track. No-op if no video track is attached.
voidrequestBitrateRequest that the remote sender reduce to a target bitrate. Sends a TMMBR RTCP message on the video track.
WebRtcTrackSender &videoSender nodiscardVideo send processor. Attach to a PacketStream after a VideoEncoder. Throws if no video track was created.
WebRtcTrackSender &audioSender nodiscardAudio send processor. Attach to a PacketStream after an AudioEncoder. Throws if no audio track was created.
WebRtcTrackReceiver &videoReceiver nodiscardVideo receive adapter. Attach as a PacketStream source. Only valid after a remote video track arrives.
WebRtcTrackReceiver &audioReceiver nodiscardAudio receive adapter. Attach as a PacketStream source. Only valid after a remote audio track arrives.
std::shared_ptr< rtc::Track >videoTrack const nodiscardThe underlying libdatachannel video track, or nullptr if none was created.
std::shared_ptr< rtc::Track >audioTrack const nodiscardThe underlying libdatachannel audio track, or nullptr if none was created.
boolhasVideo const nodiscardTrue if a video track was created at attach().
boolhasAudio const nodiscardTrue if an audio track was created at attach().
boolattached const nodiscardTrue if attach() has been called and a PeerConnection is held.

{#mediabridge-1}

MediaBridge

MediaBridge()

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:98

Construct a detached bridge with stable sender and receiver adapters.


{#mediabridge-2}

~MediaBridge

~MediaBridge()

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:100

Destroy the bridge and release any attached PeerConnection state.


{#mediabridge-3}

MediaBridge

MediaBridge(const MediaBridge &) = delete

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:103

Deleted copy constructor; MediaBridge owns live track and adapter state.


{#attach}

attach

void attach(std::shared_ptr< rtc::PeerConnection > pc, const Options & opts)

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:108

Create tracks on the PeerConnection and set up handler chains. Only creates tracks for codecs with a non-empty encoder name.


{#detach}

detach

void detach()

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:112

Detach all tracks and adapters.


{#requestkeyframe}

requestKeyframe

void requestKeyframe()

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:117

Request an immediate keyframe (IDR) from the remote sender. Sends a PLI (Picture Loss Indication) RTCP message on the video track. No-op if no video track is attached.


{#requestbitrate}

requestBitrate

void requestBitrate(unsigned int bitrate)

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:122

Request that the remote sender reduce to a target bitrate. Sends a TMMBR RTCP message on the video track.

Parameters

  • bitrate Target bitrate in bits per second.

{#videosender}

videoSender

nodiscard

[[nodiscard]] WebRtcTrackSender & videoSender()

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:130

Video send processor. Attach to a PacketStream after a VideoEncoder. Throws if no video track was created.


{#audiosender}

audioSender

nodiscard

[[nodiscard]] WebRtcTrackSender & audioSender()

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:134

Audio send processor. Attach to a PacketStream after an AudioEncoder. Throws if no audio track was created.


{#videoreceiver}

videoReceiver

nodiscard

[[nodiscard]] WebRtcTrackReceiver & videoReceiver()

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:138

Video receive adapter. Attach as a PacketStream source. Only valid after a remote video track arrives.


{#audioreceiver}

audioReceiver

nodiscard

[[nodiscard]] WebRtcTrackReceiver & audioReceiver()

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:142

Audio receive adapter. Attach as a PacketStream source. Only valid after a remote audio track arrives.


{#videotrack}

videoTrack

const nodiscard

[[nodiscard]] std::shared_ptr< rtc::Track > videoTrack() const

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:159

The underlying libdatachannel video track, or nullptr if none was created.


{#audiotrack}

audioTrack

const nodiscard

[[nodiscard]] std::shared_ptr< rtc::Track > audioTrack() const

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:162

The underlying libdatachannel audio track, or nullptr if none was created.


{#hasvideo}

hasVideo

const nodiscard

[[nodiscard]] bool hasVideo() const

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:165

True if a video track was created at attach().


{#hasaudio}

hasAudio

const nodiscard

[[nodiscard]] bool hasAudio() const

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:168

True if an audio track was created at attach().


{#attached}

attached

const nodiscard

[[nodiscard]] bool attached() const

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:171

True if attach() has been called and a PeerConnection is held.

Private Attributes

ReturnNameDescription
std::shared_ptr< rtc::PeerConnection >_pc
WebRtcTrackSender_videoSender
WebRtcTrackSender_audioSender
TrackHandle_videoHandle
TrackHandle_audioHandle
WebRtcTrackReceiver_videoReceiver
WebRtcTrackReceiver_audioReceiver
std::shared_ptr< rtc::Track >_videoReceiveTrack
std::shared_ptr< rtc::Track >_audioReceiveTrack
std::mutex_mutex

{#_pc}

_pc

std::shared_ptr< rtc::PeerConnection > _pc

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:174


{#_videosender}

_videoSender

WebRtcTrackSender _videoSender

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:178


{#_audiosender}

_audioSender

WebRtcTrackSender _audioSender

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:179


{#_videohandle}

_videoHandle

TrackHandle _videoHandle

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:180


{#_audiohandle}

_audioHandle

TrackHandle _audioHandle

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:181


{#_videoreceiver}

_videoReceiver

WebRtcTrackReceiver _videoReceiver

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:184


{#_audioreceiver}

_audioReceiver

WebRtcTrackReceiver _audioReceiver

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:185


{#_videoreceivetrack}

_videoReceiveTrack

std::shared_ptr< rtc::Track > _videoReceiveTrack

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:186


{#_audioreceivetrack}

_audioReceiveTrack

std::shared_ptr< rtc::Track > _audioReceiveTrack

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:187


{#_mutex-17}

_mutex

std::mutex _mutex

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:189

{#options-17}

Options

#include <icy/webrtc/mediabridge.h>
struct Options

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:73

Configuration options for the WebRTC media bridge.

List of all members

NameKindOwner
videoCodecvariableDeclared here
audioCodecvariableDeclared here
videoSsrcvariableDeclared here
audioSsrcvariableDeclared here
videoPayloadTypevariableDeclared here
audioPayloadTypevariableDeclared here
cnamevariableDeclared here
videoMidvariableDeclared here
audioMidvariableDeclared here
videoDirectionvariableDeclared here
audioDirectionvariableDeclared here
nackBufferSizevariableDeclared here
videoJitterBuffervariableDeclared here
audioJitterBuffervariableDeclared here

Public Attributes

ReturnNameDescription
av::VideoCodecvideoCodecVideo codec for the send track. Leave both name and encoder empty to skip creating a video track.
av::AudioCodecaudioCodecAudio codec for the send track. Leave both name and encoder empty to skip creating an audio track.
uint32_tvideoSsrc0 = auto-generate
uint32_taudioSsrc0 = auto-generate
intvideoPayloadTypeReuse negotiated offer payload type when answering, -1 = default.
intaudioPayloadTypeReuse negotiated offer payload type when answering, -1 = default.
std::stringcnameCNAME for RTCP (auto if empty).
std::stringvideoMidExplicit MID for the negotiated video m-line when answering an offer.
std::stringaudioMidExplicit MID for the negotiated audio m-line when answering an offer.
rtc::Description::DirectionvideoDirection
rtc::Description::DirectionaudioDirection
unsignednackBufferSizeMax RTP packets retained for video NACK retransmission.
JitterBufferConfigvideoJitterBufferReceive-side playout buffering for depacketized video frames.
JitterBufferConfigaudioJitterBufferReceive-side playout buffering for depacketized audio frames.

{#videocodec-6}

videoCodec

av::VideoCodec videoCodec

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:77

Video codec for the send track. Leave both name and encoder empty to skip creating a video track.


{#audiocodec-5}

audioCodec

av::AudioCodec audioCodec

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:81

Audio codec for the send track. Leave both name and encoder empty to skip creating an audio track.


{#videossrc}

videoSsrc

uint32_t videoSsrc = 0

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:83

0 = auto-generate


{#audiossrc}

audioSsrc

uint32_t audioSsrc = 0

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:84

0 = auto-generate


{#videopayloadtype}

videoPayloadType

int videoPayloadType = -1

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:85

Reuse negotiated offer payload type when answering, -1 = default.


{#audiopayloadtype}

audioPayloadType

int audioPayloadType = -1

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:86

Reuse negotiated offer payload type when answering, -1 = default.


{#cname}

cname

std::string cname

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:87

CNAME for RTCP (auto if empty).


{#videomid}

videoMid

std::string videoMid

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:88

Explicit MID for the negotiated video m-line when answering an offer.


{#audiomid}

audioMid

std::string audioMid

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:89

Explicit MID for the negotiated audio m-line when answering an offer.


{#videodirection}

videoDirection

rtc::Description::Direction videoDirection = rtc::Description::Direction::SendRecv

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:90


{#audiodirection}

audioDirection

rtc::Description::Direction audioDirection = rtc::Description::Direction::SendRecv

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:91


{#nackbuffersize}

nackBufferSize

unsigned nackBufferSize = 512

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:92

Max RTP packets retained for video NACK retransmission.


{#videojitterbuffer}

videoJitterBuffer

JitterBufferConfig videoJitterBuffer

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:93

Receive-side playout buffering for depacketized video frames.


{#audiojitterbuffer}

audioJitterBuffer

JitterBufferConfig audioJitterBuffer

Defined in src/webrtc/include/icy/webrtc/mediabridge.h:94

Receive-side playout buffering for depacketized audio frames.

{#peersession}

PeerSession

#include <icy/webrtc/peersession.h>
class PeerSession

Defined in src/webrtc/include/icy/webrtc/peersession.h:45

Manages a WebRTC peer connection lifecycle over any signalling transport that implements SignallingInterface.

Works with SympleSignaller (Symple call protocol), WebSocketSignaller (plain JSON over WSS), or any custom implementation.

Media is optional. Set [Config::media](#media-2) codecs to enable tracks. Leave codec encoders empty for data-channel-only sessions.

List of all members

NameKindOwner
StateChangedvariableDeclared here
IncomingCallvariableDeclared here
DataReceivedvariableDeclared here
PeerSessionfunctionDeclared here
PeerSessionfunctionDeclared here
callfunctionDeclared here
acceptfunctionDeclared here
rejectfunctionDeclared here
hangupfunctionDeclared here
sendDatafunctionDeclared here
sendDatafunctionDeclared here
statefunctionDeclared here
remotePeerIdfunctionDeclared here
mediafunctionDeclared here
mediafunctionDeclared here
peerConnectionfunctionDeclared here
dataChannelfunctionDeclared here
StateenumDeclared here
_signallervariableDeclared here
_configvariableDeclared here
_mediavariableDeclared here
_statevariableDeclared here
_remotePeerIdvariableDeclared here
_pcvariableDeclared here
_dcvariableDeclared here
_callbackGuardvariableDeclared here
_remoteDescriptionSetvariableDeclared here
_pendingRemoteCandidatesvariableDeclared here
_callbackSyncvariableDeclared here
_pendingCallbacksvariableDeclared here
_callbackMutexvariableDeclared here
_mutexvariableDeclared here
onSdpReceivedfunctionDeclared here
onCandidateReceivedfunctionDeclared here
onControlReceivedfunctionDeclared here
createPeerConnectionfunctionDeclared here
setupPeerConnectionCallbacksfunctionDeclared here
beginEndCallfunctionDeclared here
finishEndCallfunctionDeclared here
transitionEndedToIdlefunctionDeclared here
enqueueCallbackfunctionDeclared here
drainCallbacksfunctionDeclared here

Public Attributes

ReturnNameDescription
ThreadSignal< void(State)>StateChangedEmitted whenever the session state changes. Parameter: new State value.
ThreadSignal< void(const std::string &)>IncomingCallEmitted when a remote peer initiates a call (state transitions to IncomingInit). Parameter: remote peer identifier.
ThreadSignal< void(rtc::message_variant)>DataReceivedEmitted when a message arrives on the data channel. Parameter: rtc::message_variant (string or binary).

{#statechanged}

StateChanged

ThreadSignal< void(State)> StateChanged

Defined in src/webrtc/include/icy/webrtc/peersession.h:125

Emitted whenever the session state changes. Parameter: new State value.


{#incomingcall}

IncomingCall

ThreadSignal< void(const std::string &)> IncomingCall

Defined in src/webrtc/include/icy/webrtc/peersession.h:129

Emitted when a remote peer initiates a call (state transitions to IncomingInit). Parameter: remote peer identifier.


{#datareceived}

DataReceived

ThreadSignal< void(rtc::message_variant)> DataReceived

Defined in src/webrtc/include/icy/webrtc/peersession.h:133

Emitted when a message arrives on the data channel. Parameter: rtc::message_variant (string or binary).

Public Methods

ReturnNameDescription
PeerSessionConstruct with any signalling implementation. The signaller must outlive this PeerSession.
PeerSessionDeleted copy constructor; PeerSession owns live signalling and RTC callbacks.
voidcallInitiate an outgoing call to a remote peer. Sends a "init" control message and transitions to OutgoingInit.
voidacceptAccept an incoming call. Creates the PeerConnection, sends "accept", and transitions to Negotiating.
voidrejectReject an incoming call. Sends a "reject" control message and transitions to Ended.
voidhangupTerminate any non-idle call phase. Sends a "hangup" control message, closes the PeerConnection, and transitions to Ended. Safe to call from any non-Idle/Ended state.
voidsendDataSend a UTF-8 string message over the data channel. Silently dropped if the data channel is not open.
voidsendDataSend raw binary data over the data channel. Silently dropped if the data channel is not open.
Statestate const nodiscardCurrent session state. Thread-safe.
std::stringremotePeerId const nodiscardIdentifier of the remote peer for the current or most recent call. Empty when Idle.
MediaBridge &media nodiscardMedia bridge for this session. Valid for the lifetime of the PeerSession.
const MediaBridge &media const nodiscardMedia bridge for this session. Valid for the lifetime of the PeerSession.
std::shared_ptr< rtc::PeerConnection >peerConnection nodiscardThe underlying PeerConnection, or nullptr when Idle/Ended.
std::shared_ptr< rtc::DataChannel >dataChannel nodiscardThe data channel, or nullptr if none is open.

{#peersession-1}

PeerSession

PeerSession(SignallingInterface & signaller, const Config & config)

Defined in src/webrtc/include/icy/webrtc/peersession.h:82

Construct with any signalling implementation. The signaller must outlive this PeerSession.


{#peersession-2}

PeerSession

PeerSession(const PeerSession &) = delete

Defined in src/webrtc/include/icy/webrtc/peersession.h:86

Deleted copy constructor; PeerSession owns live signalling and RTC callbacks.


{#call}

call

void call(const std::string & peerId)

Defined in src/webrtc/include/icy/webrtc/peersession.h:93

Initiate an outgoing call to a remote peer. Sends a "init" control message and transitions to OutgoingInit.

Parameters

  • peerId Remote peer identifier passed to the signaller.

Exceptions

  • std::logic_error if not currently in the Idle state.

{#accept}

accept

void accept()

Defined in src/webrtc/include/icy/webrtc/peersession.h:98

Accept an incoming call. Creates the PeerConnection, sends "accept", and transitions to Negotiating.

Exceptions

  • std::logic_error if not currently in the IncomingInit state.

{#reject}

reject

void reject(const std::string & reason = "declined")

Defined in src/webrtc/include/icy/webrtc/peersession.h:104

Reject an incoming call. Sends a "reject" control message and transitions to Ended.

Parameters

  • reason Human-readable reason string forwarded to the remote peer.

Exceptions

  • std::logic_error if not currently in the IncomingInit state.

{#hangup}

hangup

void hangup(const std::string & reason = "hangup")

Defined in src/webrtc/include/icy/webrtc/peersession.h:110

Terminate any non-idle call phase. Sends a "hangup" control message, closes the PeerConnection, and transitions to Ended. Safe to call from any non-Idle/Ended state.

Parameters

  • reason Human-readable reason string forwarded to the remote peer.

{#senddata-2}

sendData

void sendData(const std::string & message)

Defined in src/webrtc/include/icy/webrtc/peersession.h:115

Send a UTF-8 string message over the data channel. Silently dropped if the data channel is not open.

Parameters

  • message String to send.

{#senddata-3}

sendData

void sendData(const std::byte * data, size_t size)

Defined in src/webrtc/include/icy/webrtc/peersession.h:121

Send raw binary data over the data channel. Silently dropped if the data channel is not open.

Parameters

  • data Pointer to the byte buffer.

  • size Number of bytes to send.


{#state-3}

state

const nodiscard

[[nodiscard]] State state() const

Defined in src/webrtc/include/icy/webrtc/peersession.h:136

Current session state. Thread-safe.


{#remotepeerid}

remotePeerId

const nodiscard

[[nodiscard]] std::string remotePeerId() const

Defined in src/webrtc/include/icy/webrtc/peersession.h:140

Identifier of the remote peer for the current or most recent call. Empty when Idle.


{#media}

media

nodiscard

[[nodiscard]] MediaBridge & media()

Defined in src/webrtc/include/icy/webrtc/peersession.h:143

Media bridge for this session. Valid for the lifetime of the PeerSession.


{#media-1}

media

const nodiscard

[[nodiscard]] const MediaBridge & media() const

Defined in src/webrtc/include/icy/webrtc/peersession.h:145

Media bridge for this session. Valid for the lifetime of the PeerSession.


{#peerconnection}

peerConnection

nodiscard

[[nodiscard]] std::shared_ptr< rtc::PeerConnection > peerConnection()

Defined in src/webrtc/include/icy/webrtc/peersession.h:148

The underlying PeerConnection, or nullptr when Idle/Ended.


{#datachannel}

dataChannel

nodiscard

[[nodiscard]] std::shared_ptr< rtc::DataChannel > dataChannel()

Defined in src/webrtc/include/icy/webrtc/peersession.h:151

The data channel, or nullptr if none is open.

Public Types

NameDescription
StateHigh-level lifecycle phases for a single peer-to-peer call session.

{#state-4}

State

enum State

Defined in src/webrtc/include/icy/webrtc/peersession.h:49

High-level lifecycle phases for a single peer-to-peer call session.

ValueDescription
IdleNo active call.
OutgoingInitOutgoing call announced, waiting for accept/reject.
IncomingInitIncoming call announced, waiting for accept/reject.
NegotiatingPeerConnection exists and SDP/ICE negotiation is in progress.
ActiveMedia or data is flowing.
EndingLocal teardown is in progress.
EndedCall ended (transient; auto-resets to Idle).

Private Attributes

ReturnNameDescription
SignallingInterface &_signaller
Config_config
MediaBridge_media
State_state
std::string_remotePeerId
std::shared_ptr< rtc::PeerConnection >_pc
std::shared_ptr< rtc::DataChannel >_dc
std::shared_ptr< CallbackGuard >_callbackGuard
bool_remoteDescriptionSet
std::vector< PendingCandidate >_pendingRemoteCandidates
Synchronizer_callbackSync
std::deque< std::function< void()> >_pendingCallbacks
std::mutex_callbackMutex
std::mutex_mutex

{#_signaller}

_signaller

SignallingInterface & _signaller

Defined in src/webrtc/include/icy/webrtc/peersession.h:181


{#_config-4}

_config

Config _config

Defined in src/webrtc/include/icy/webrtc/peersession.h:182


{#_media}

_media

MediaBridge _media

Defined in src/webrtc/include/icy/webrtc/peersession.h:183


{#_state-4}

_state

State _state = 

Defined in src/webrtc/include/icy/webrtc/peersession.h:184


{#_remotepeerid}

_remotePeerId

std::string _remotePeerId

Defined in src/webrtc/include/icy/webrtc/peersession.h:185


{#_pc-1}

_pc

std::shared_ptr< rtc::PeerConnection > _pc

Defined in src/webrtc/include/icy/webrtc/peersession.h:186


{#_dc}

_dc

std::shared_ptr< rtc::DataChannel > _dc

Defined in src/webrtc/include/icy/webrtc/peersession.h:187


{#_callbackguard}

_callbackGuard

std::shared_ptr< CallbackGuard > _callbackGuard = std::make_shared<CallbackGuard>()

Defined in src/webrtc/include/icy/webrtc/peersession.h:188


{#_remotedescriptionset}

_remoteDescriptionSet

bool _remoteDescriptionSet = false

Defined in src/webrtc/include/icy/webrtc/peersession.h:189


{#_pendingremotecandidates}

_pendingRemoteCandidates

std::vector< PendingCandidate > _pendingRemoteCandidates

Defined in src/webrtc/include/icy/webrtc/peersession.h:190


{#_callbacksync}

_callbackSync

Synchronizer _callbackSync

Defined in src/webrtc/include/icy/webrtc/peersession.h:191


{#_pendingcallbacks}

_pendingCallbacks

std::deque< std::function< void()> > _pendingCallbacks

Defined in src/webrtc/include/icy/webrtc/peersession.h:192


{#_callbackmutex}

_callbackMutex

std::mutex _callbackMutex

Defined in src/webrtc/include/icy/webrtc/peersession.h:193


{#_mutex-18}

_mutex

std::mutex _mutex

Defined in src/webrtc/include/icy/webrtc/peersession.h:194

Private Methods

ReturnNameDescription
voidonSdpReceived
voidonCandidateReceived
voidonControlReceived
std::shared_ptr< rtc::PeerConnection >createPeerConnection
voidsetupPeerConnectionCallbacks
voidbeginEndCall
voidfinishEndCall
voidtransitionEndedToIdle
voidenqueueCallback
voiddrainCallbacks

{#onsdpreceived}

onSdpReceived

void onSdpReceived(const std::string & peerId, const std::string & type, const std::string & sdp)

Defined in src/webrtc/include/icy/webrtc/peersession.h:165


{#oncandidatereceived}

onCandidateReceived

void onCandidateReceived(const std::string & peerId, const std::string & candidate, const std::string & mid)

Defined in src/webrtc/include/icy/webrtc/peersession.h:166


{#oncontrolreceived}

onControlReceived

void onControlReceived(const std::string & peerId, const std::string & type, const std::string & reason)

Defined in src/webrtc/include/icy/webrtc/peersession.h:167


{#createpeerconnection}

createPeerConnection

std::shared_ptr< rtc::PeerConnection > createPeerConnection(bool createDataChannel, const MediaBridge::Options * mediaOpts = nullptr)

Defined in src/webrtc/include/icy/webrtc/peersession.h:169


{#setuppeerconnectioncallbacks}

setupPeerConnectionCallbacks

void setupPeerConnectionCallbacks(const std::shared_ptr< rtc::PeerConnection > & pc)

Defined in src/webrtc/include/icy/webrtc/peersession.h:172


{#beginendcall}

beginEndCall

void beginEndCall(const std::string & reason, std::shared_ptr< rtc::PeerConnection > & pc, std::shared_ptr< rtc::DataChannel > & dc)

Defined in src/webrtc/include/icy/webrtc/peersession.h:173


{#finishendcall}

finishEndCall

void finishEndCall()

Defined in src/webrtc/include/icy/webrtc/peersession.h:176


{#transitionendedtoidle}

transitionEndedToIdle

void transitionEndedToIdle()

Defined in src/webrtc/include/icy/webrtc/peersession.h:177


{#enqueuecallback}

enqueueCallback

void enqueueCallback(std::function< void()> callback)

Defined in src/webrtc/include/icy/webrtc/peersession.h:178


{#draincallbacks}

drainCallbacks

void drainCallbacks()

Defined in src/webrtc/include/icy/webrtc/peersession.h:179

{#mediaconfig}

MediaConfig

#include <icy/webrtc/peersession.h>
struct MediaConfig

Defined in src/webrtc/include/icy/webrtc/peersession.h:61

Configuration for WebRTC peer session establishment.

List of all members

NameKindOwner
videoCodecvariableDeclared here
audioCodecvariableDeclared here
videoDirectionvariableDeclared here
audioDirectionvariableDeclared here
videoJitterBuffervariableDeclared here
audioJitterBuffervariableDeclared here

Public Attributes

ReturnNameDescription
av::VideoCodecvideoCodecDesired video codec for send/receive negotiation.
av::AudioCodecaudioCodecDesired audio codec for send/receive negotiation.
rtc::Description::DirectionvideoDirection
rtc::Description::DirectionaudioDirection
JitterBufferConfigvideoJitterBufferReceive-side buffering for depacketized remote video frames.
JitterBufferConfigaudioJitterBufferReceive-side buffering for depacketized remote audio frames.

{#videocodec-7}

videoCodec

av::VideoCodec videoCodec

Defined in src/webrtc/include/icy/webrtc/peersession.h:63

Desired video codec for send/receive negotiation.


{#audiocodec-6}

audioCodec

av::AudioCodec audioCodec

Defined in src/webrtc/include/icy/webrtc/peersession.h:64

Desired audio codec for send/receive negotiation.


{#videodirection-1}

videoDirection

rtc::Description::Direction videoDirection = rtc::Description::Direction::SendRecv

Defined in src/webrtc/include/icy/webrtc/peersession.h:65


{#audiodirection-1}

audioDirection

rtc::Description::Direction audioDirection = rtc::Description::Direction::SendRecv

Defined in src/webrtc/include/icy/webrtc/peersession.h:66


{#videojitterbuffer-1}

videoJitterBuffer

JitterBufferConfig videoJitterBuffer

Defined in src/webrtc/include/icy/webrtc/peersession.h:67

Receive-side buffering for depacketized remote video frames.


{#audiojitterbuffer-1}

audioJitterBuffer

JitterBufferConfig audioJitterBuffer

Defined in src/webrtc/include/icy/webrtc/peersession.h:68

Receive-side buffering for depacketized remote audio frames.

{#config-4}

Config

#include <icy/webrtc/peersession.h>
struct Config

Defined in src/webrtc/include/icy/webrtc/peersession.h:72

Configuration for WebRTC peer session establishment.

List of all members

NameKindOwner
rtcConfigvariableDeclared here
mediavariableDeclared here
enableDataChannelvariableDeclared here
dataChannelLabelvariableDeclared here

Public Attributes

ReturnNameDescription
rtc::ConfigurationrtcConfiglibdatachannel connection options, ICE servers, and transport settings.
MediaConfigmediaDesired media codecs and directions for the session.
boolenableDataChannelTrue to create a data channel on outgoing calls and accept one on incoming calls.
std::stringdataChannelLabelLabel to use for the application data channel.

{#rtcconfig}

rtcConfig

rtc::Configuration rtcConfig

Defined in src/webrtc/include/icy/webrtc/peersession.h:74

libdatachannel connection options, ICE servers, and transport settings.


{#media-2}

media

MediaConfig media

Defined in src/webrtc/include/icy/webrtc/peersession.h:75

Desired media codecs and directions for the session.


{#enabledatachannel}

enableDataChannel

bool enableDataChannel = true

Defined in src/webrtc/include/icy/webrtc/peersession.h:76

True to create a data channel on outgoing calls and accept one on incoming calls.


{#datachannellabel}

dataChannelLabel

std::string dataChannelLabel = "data"

Defined in src/webrtc/include/icy/webrtc/peersession.h:77

Label to use for the application data channel.

{#callbackguard}

CallbackGuard

struct CallbackGuard

Defined in src/webrtc/include/icy/webrtc/peersession.h:154

List of all members

NameKindOwner
alivevariableDeclared here

Public Attributes

ReturnNameDescription
std::atomic< bool >alive

{#alive-1}

alive

std::atomic< bool > alive {true}

Defined in src/webrtc/include/icy/webrtc/peersession.h:156

{#pendingcandidate}

PendingCandidate

struct PendingCandidate

Defined in src/webrtc/include/icy/webrtc/peersession.h:159

List of all members

NameKindOwner
candidatevariableDeclared here
midvariableDeclared here

Public Attributes

ReturnNameDescription
std::stringcandidate
std::stringmid

{#candidate}

candidate

std::string candidate

Defined in src/webrtc/include/icy/webrtc/peersession.h:161


{#mid}

mid

std::string mid

Defined in src/webrtc/include/icy/webrtc/peersession.h:162

{#webrtctracksender}

WebRtcTrackSender

#include <icy/webrtc/tracksender.h>
class WebRtcTrackSender

Defined in src/webrtc/include/icy/webrtc/tracksender.h:56

Inherits: PacketProcessor

PacketProcessor that sends encoded media to a single libdatachannel Track via sendFrame().

Bind to one track (video or audio). Accepts the corresponding packet type from the PacketStream and converts timestamps from FFmpeg microseconds to the track's RTP clock rate.

Usage: auto vh = createVideoTrack(pc, codec); WebRtcTrackSender videoSender(vh);

PacketStream stream; stream.attachSource(capture); stream.attach(encoder, 1, true); stream.attach(&videoSender, 5, false); stream.start();

Only emits the packet downstream on successful send, so a chained recorder won't record frames that failed to transmit.

Accepts only the packet type that matches the bound track. Non-matching packets are passed through unchanged so mixed audio/video PacketStream chains can share one source cleanly.

List of all members

NameKindOwner
emittervariableDeclared here
WebRtcTrackSenderfunctionDeclared here
WebRtcTrackSenderfunctionDeclared here
bindfunctionDeclared here
unbindfunctionDeclared here
processfunctionDeclared here
acceptsfunctionDeclared here
onStreamStateChangefunctionDeclared here
isVideofunctionDeclared here
boundfunctionDeclared here
_trackvariableDeclared here
_rtpConfigvariableDeclared here
_kindvariableDeclared here
_mutexvariableDeclared here
PacketProcessorfunctionInherited from PacketProcessor
processfunctionInherited from PacketProcessor
acceptsfunctionInherited from PacketProcessor
operator<<functionInherited from PacketProcessor
_emittervariableInherited from PacketStreamAdapter
PacketStreamAdapterfunctionInherited from PacketStreamAdapter
~PacketStreamAdapterfunctionInherited from PacketStreamAdapter
emitfunctionInherited from PacketStreamAdapter
emitfunctionInherited from PacketStreamAdapter
emitfunctionInherited from PacketStreamAdapter
emitfunctionInherited from PacketStreamAdapter
emitfunctionInherited from PacketStreamAdapter
getEmitterfunctionInherited from PacketStreamAdapter
retentionfunctionInherited from PacketStreamAdapter
onStreamStateChangefunctionInherited from PacketStreamAdapter
PacketStreamAdapterfunctionInherited from PacketStreamAdapter
operator=functionInherited from PacketStreamAdapter
PacketStreamAdapterfunctionInherited from PacketStreamAdapter
operator=functionInherited from PacketStreamAdapter

Inherited from PacketProcessor

KindNameDescription
functionPacketProcessor inline
functionprocess virtualThis method performs processing on the given packet and emits the result.
functionaccepts virtual inlineThis method ensures compatibility with the given packet type. Return false to reject the packet.
functionoperator<< virtual inlineStream operator alias for process().

Inherited from PacketStreamAdapter

KindNameDescription
variable_emitter
functionPacketStreamAdapterConstruct the adapter, binding it to the given packet signal.
function~PacketStreamAdapter virtual inline
functionemit virtualEmit a mutable raw buffer as a packet.
functionemit virtualEmit a read-only raw buffer as a packet (data is copied internally).
functionemit virtualEmit a string as a packet (data is copied internally).
functionemit virtualEmit a flag-only packet carrying no payload data.
functionemit virtualEmit an existing packet directly onto the outgoing signal.
functiongetEmitterReturns a reference to the outgoing packet signal.
functionretention virtual const nodiscardReturns how this adapter treats incoming packet lifetime. Most adapters are synchronous and therefore only borrow the packet for the current call chain. Queue-style adapters override this to advertise that they clone before deferred use. Callers may treat the first adapter reporting Cloned or Retained as the explicit ownership boundary in the stream graph.
functiononStreamStateChange virtual inlineCalled by the PacketStream to notify when the internal Stream state changes. On receiving the Stopped state, it is the responsibility of the adapter to have ceased all outgoing packet transmission, especially in multi-thread scenarios.
functionPacketStreamAdapterNonCopyable and NonMovable.
functionoperator=Deleted assignment operator.
functionPacketStreamAdapterDeleted constructor.
functionoperator=Deleted assignment operator.

Public Attributes

ReturnNameDescription
PacketSignalemitter

{#emitter-10}

emitter

PacketSignal emitter

Defined in src/webrtc/include/icy/webrtc/tracksender.h:96

Public Methods

ReturnNameDescription
WebRtcTrackSenderConstruct an unbound sender. Call bind() before use.
WebRtcTrackSender explicitConstruct bound to a track handle from createVideoTrack() or createAudioTrack().
voidbindBind to a track. Can be called to rebind to a different track.
voidunbindUnbind from the current track.
voidprocess virtual overrideSend an encoded media frame to the bound WebRTC track. Converts the FFmpeg microsecond timestamp to an RTP timestamp using the track's clock rate, then calls rtc::Track::sendFrame(). Only forwards the packet downstream on a successful send.
boolaccepts virtual overrideReturn true only for the packet type that matches the bound track.
voidonStreamStateChange virtual overrideCalled by the PacketStream when stream state changes. Logs when the stream is stopping; no other action is taken.
boolisVideo const nodiscardTrue if this sender is bound to a video track.
boolbound const nodiscardTrue if bound to any track.

{#webrtctracksender-1}

WebRtcTrackSender

WebRtcTrackSender()

Defined in src/webrtc/include/icy/webrtc/tracksender.h:60

Construct an unbound sender. Call bind() before use.


{#webrtctracksender-2}

WebRtcTrackSender

explicit

explicit WebRtcTrackSender(const TrackHandle & handle)

Defined in src/webrtc/include/icy/webrtc/tracksender.h:64

Construct bound to a track handle from createVideoTrack() or createAudioTrack().


{#bind-5}

bind

void bind(const TrackHandle & handle)

Defined in src/webrtc/include/icy/webrtc/tracksender.h:67

Bind to a track. Can be called to rebind to a different track.


{#unbind-1}

unbind

void unbind()

Defined in src/webrtc/include/icy/webrtc/tracksender.h:70

Unbind from the current track.


{#process-12}

process

virtual override

virtual void process(IPacket & packet) override

Defined in src/webrtc/include/icy/webrtc/tracksender.h:78

Send an encoded media frame to the bound WebRTC track. Converts the FFmpeg microsecond timestamp to an RTP timestamp using the track's clock rate, then calls rtc::Track::sendFrame(). Only forwards the packet downstream on a successful send.

Parameters

Reimplements

{#accepts-5}

accepts

virtual override

virtual bool accepts(IPacket * packet) override

Defined in src/webrtc/include/icy/webrtc/tracksender.h:83

Return true only for the packet type that matches the bound track.

Parameters

  • packet Packet to test. May be nullptr.

Returns

True if the packet can be processed by this sender.

Reimplements

{#onstreamstatechange-6}

onStreamStateChange

virtual override

virtual void onStreamStateChange(const PacketStreamState & state) override

Defined in src/webrtc/include/icy/webrtc/tracksender.h:88

Called by the PacketStream when stream state changes. Logs when the stream is stopping; no other action is taken.

Parameters

Reimplements

{#isvideo}

isVideo

const nodiscard

[[nodiscard]] bool isVideo() const

Defined in src/webrtc/include/icy/webrtc/tracksender.h:91

True if this sender is bound to a video track.


{#bound}

bound

const nodiscard

[[nodiscard]] bool bound() const

Defined in src/webrtc/include/icy/webrtc/tracksender.h:94

True if bound to any track.

Private Attributes

ReturnNameDescription
std::shared_ptr< rtc::Track >_track
std::shared_ptr< rtc::RtpPacketizationConfig >_rtpConfig
std::atomic< TrackKind >_kind
std::mutex_mutex

{#_track}

_track

std::shared_ptr< rtc::Track > _track

Defined in src/webrtc/include/icy/webrtc/tracksender.h:106


{#_rtpconfig}

_rtpConfig

std::shared_ptr< rtc::RtpPacketizationConfig > _rtpConfig

Defined in src/webrtc/include/icy/webrtc/tracksender.h:107


{#_kind}

_kind

std::atomic< TrackKind > _kind {TrackKind::Unbound}

Defined in src/webrtc/include/icy/webrtc/tracksender.h:108


{#_mutex-19}

_mutex

std::mutex _mutex

Defined in src/webrtc/include/icy/webrtc/tracksender.h:109

{#webrtctrackreceiver}

WebRtcTrackReceiver

#include <icy/webrtc/trackreceiver.h>
class WebRtcTrackReceiver

Defined in src/webrtc/include/icy/webrtc/trackreceiver.h:61

Inherits: PacketStreamAdapter

PacketStreamAdapter that receives depacketized frames from a single remote libdatachannel Track and emits them as VideoPacket or AudioPacket into a PacketStream.

Call setupReceiveTrack() on the track first to install the correct depacketizer, then bind this receiver to it.

Usage: pc->onTrack([&](shared_ptrrtc::Track track) { if (setupReceiveTrack(track)) videoReceiver.bind(track); });

videoReceiver.emitter += packetSlot(&recorder, &Recorder::onEncodedVideo);

Emits owning packets - the frame data is copied, so downstream processors can safely queue packets asynchronously.

Emits VideoPacket for video tracks, AudioPacket for audio tracks. Use those packets to drive a decoder, recorder, or custom pipeline. See samples/media-recorder for a complete receive -> decode -> file example.

List of all members

NameKindOwner
emittervariableDeclared here
WebRtcTrackReceiverfunctionDeclared here
bindfunctionDeclared here
configureJitterBufferfunctionDeclared here
jitterBufferConfigfunctionDeclared here
jitterBufferEnabledfunctionDeclared here
_dispatchvariableDeclared here
_timervariableDeclared here
_mutexvariableDeclared here
_pendingvariableDeclared here
_jitterBuffervariableDeclared here
_jitterConfigvariableDeclared here
_timerTickMsvariableDeclared here
_timerNeedsUpdatevariableDeclared here
_statevariableDeclared here
_generationvariableDeclared here
enqueuefunctionDeclared here
flushPendingfunctionDeclared here
_emittervariableInherited from PacketStreamAdapter
PacketStreamAdapterfunctionInherited from PacketStreamAdapter
~PacketStreamAdapterfunctionInherited from PacketStreamAdapter
emitfunctionInherited from PacketStreamAdapter
emitfunctionInherited from PacketStreamAdapter
emitfunctionInherited from PacketStreamAdapter
emitfunctionInherited from PacketStreamAdapter
emitfunctionInherited from PacketStreamAdapter
getEmitterfunctionInherited from PacketStreamAdapter
retentionfunctionInherited from PacketStreamAdapter
onStreamStateChangefunctionInherited from PacketStreamAdapter
PacketStreamAdapterfunctionInherited from PacketStreamAdapter
operator=functionInherited from PacketStreamAdapter
PacketStreamAdapterfunctionInherited from PacketStreamAdapter
operator=functionInherited from PacketStreamAdapter

Inherited from PacketStreamAdapter

KindNameDescription
variable_emitter
functionPacketStreamAdapterConstruct the adapter, binding it to the given packet signal.
function~PacketStreamAdapter virtual inline
functionemit virtualEmit a mutable raw buffer as a packet.
functionemit virtualEmit a read-only raw buffer as a packet (data is copied internally).
functionemit virtualEmit a string as a packet (data is copied internally).
functionemit virtualEmit a flag-only packet carrying no payload data.
functionemit virtualEmit an existing packet directly onto the outgoing signal.
functiongetEmitterReturns a reference to the outgoing packet signal.
functionretention virtual const nodiscardReturns how this adapter treats incoming packet lifetime. Most adapters are synchronous and therefore only borrow the packet for the current call chain. Queue-style adapters override this to advertise that they clone before deferred use. Callers may treat the first adapter reporting Cloned or Retained as the explicit ownership boundary in the stream graph.
functiononStreamStateChange virtual inlineCalled by the PacketStream to notify when the internal Stream state changes. On receiving the Stopped state, it is the responsibility of the adapter to have ceased all outgoing packet transmission, especially in multi-thread scenarios.
functionPacketStreamAdapterNonCopyable and NonMovable.
functionoperator=Deleted assignment operator.
functionPacketStreamAdapterDeleted constructor.
functionoperator=Deleted assignment operator.

Public Attributes

ReturnNameDescription
PacketSignalemitter

{#emitter-11}

emitter

PacketSignal emitter

Defined in src/webrtc/include/icy/webrtc/trackreceiver.h:87

Public Methods

ReturnNameDescription
WebRtcTrackReceiverConstruct an unbound receiver. Call bind() to attach a remote track.
voidbindBind to a remote track. Must be called after setupReceiveTrack() returned true. Installs an onFrame callback that converts each depacketized frame to a VideoPacket or AudioPacket and emits it on the PacketStream. The track type (video/audio) is detected from the SDP description.
voidconfigureJitterBufferReplace the receive-side jitter-buffer settings.
JitterBufferConfigjitterBufferConfig const nodiscardCurrent jitter-buffer settings for this receiver.
booljitterBufferEnabled const nodiscardTrue when depacketized receive frames are buffered before emission.

{#webrtctrackreceiver-1}

WebRtcTrackReceiver

WebRtcTrackReceiver()

Defined in src/webrtc/include/icy/webrtc/trackreceiver.h:65

Construct an unbound receiver. Call bind() to attach a remote track.


{#bind-6}

bind

void bind(std::shared_ptr< rtc::Track > track)

Defined in src/webrtc/include/icy/webrtc/trackreceiver.h:74

Bind to a remote track. Must be called after setupReceiveTrack() returned true. Installs an onFrame callback that converts each depacketized frame to a VideoPacket or AudioPacket and emits it on the PacketStream. The track type (video/audio) is detected from the SDP description.

Parameters

  • track Remote track from the PeerConnection::onTrack callback.

{#configurejitterbuffer}

configureJitterBuffer

void configureJitterBuffer(const JitterBufferConfig & config)

Defined in src/webrtc/include/icy/webrtc/trackreceiver.h:79

Replace the receive-side jitter-buffer settings.

Reconfiguring resets any buffered media still waiting for release.


{#jitterbufferconfig-1}

jitterBufferConfig

const nodiscard

[[nodiscard]] JitterBufferConfig jitterBufferConfig() const

Defined in src/webrtc/include/icy/webrtc/trackreceiver.h:82

Current jitter-buffer settings for this receiver.


{#jitterbufferenabled}

jitterBufferEnabled

const nodiscard

[[nodiscard]] bool jitterBufferEnabled() const

Defined in src/webrtc/include/icy/webrtc/trackreceiver.h:85

True when depacketized receive frames are buffered before emission.

Private Attributes

ReturnNameDescription
Synchronizer_dispatch
Timer_timer
std::mutex_mutex
std::deque< std::unique_ptr< IPacket > >_pending
std::unique_ptr< detail::ReceiverJitterBuffer >_jitterBuffer
JitterBufferConfig_jitterConfig
std::int64_t_timerTickMs
bool_timerNeedsUpdate
std::shared_ptr< DispatchState >_state
uint64_t_generation

{#_dispatch}

_dispatch

Synchronizer _dispatch

Defined in src/webrtc/include/icy/webrtc/trackreceiver.h:99


{#_timer-3}

_timer

Timer _timer

Defined in src/webrtc/include/icy/webrtc/trackreceiver.h:100


{#_mutex-20}

_mutex

std::mutex _mutex

Defined in src/webrtc/include/icy/webrtc/trackreceiver.h:101


{#_pending}

_pending

std::deque< std::unique_ptr< IPacket > > _pending

Defined in src/webrtc/include/icy/webrtc/trackreceiver.h:102


{#_jitterbuffer}

_jitterBuffer

std::unique_ptr< detail::ReceiverJitterBuffer > _jitterBuffer

Defined in src/webrtc/include/icy/webrtc/trackreceiver.h:103


{#_jitterconfig}

_jitterConfig

JitterBufferConfig _jitterConfig

Defined in src/webrtc/include/icy/webrtc/trackreceiver.h:104


{#_timertickms}

_timerTickMs

std::int64_t _timerTickMs = 5

Defined in src/webrtc/include/icy/webrtc/trackreceiver.h:105


{#_timerneedsupdate}

_timerNeedsUpdate

bool _timerNeedsUpdate = false

Defined in src/webrtc/include/icy/webrtc/trackreceiver.h:106


{#_state-5}

_state

std::shared_ptr< DispatchState > _state = std::make_shared<DispatchState>()

Defined in src/webrtc/include/icy/webrtc/trackreceiver.h:107


{#_generation}

_generation

uint64_t _generation = 0

Defined in src/webrtc/include/icy/webrtc/trackreceiver.h:108

Private Methods

ReturnNameDescription
voidenqueue
voidflushPending

{#enqueue}

enqueue

void enqueue(std::unique_ptr< IPacket > packet)

Defined in src/webrtc/include/icy/webrtc/trackreceiver.h:96


{#flushpending}

flushPending

void flushPending()

Defined in src/webrtc/include/icy/webrtc/trackreceiver.h:97

{#dispatchstate}

DispatchState

struct DispatchState

Defined in src/webrtc/include/icy/webrtc/trackreceiver.h:90

List of all members

NameKindOwner
alivevariableDeclared here
generationvariableDeclared here

Public Attributes

ReturnNameDescription
std::atomic< bool >alive
std::atomic< uint64_t >generation

{#alive-2}

alive

std::atomic< bool > alive {true}

Defined in src/webrtc/include/icy/webrtc/trackreceiver.h:92


{#generation}

generation

std::atomic< uint64_t > generation {0}

Defined in src/webrtc/include/icy/webrtc/trackreceiver.h:93

{#codecnegotiator}

CodecNegotiator

#include <icy/webrtc/codecnegotiator.h>
class CodecNegotiator

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:118

Maps RTP codec names to FFmpeg encoders and queries FFmpeg at runtime to determine what codecs are available.

This is stateless - all methods are static. Call negotiate*() with a list of RTP codec names offered by the remote peer, and it returns the best match that FFmpeg can encode.

List of all members

NameKindOwner
negotiateVideofunctionDeclared here
negotiateAudiofunctionDeclared here
hasEncoderfunctionDeclared here
rtpToFfmpegfunctionDeclared here
ffmpegToRtpfunctionDeclared here
clockRatefunctionDeclared here
defaultPayloadTypefunctionDeclared here
specFromRtpfunctionDeclared here
specFromFfmpegfunctionDeclared here
specFromVideoCodecfunctionDeclared here
specFromAudioCodecfunctionDeclared here
requireVideoSpecfunctionDeclared here
requireAudioSpecfunctionDeclared here
resolveWebRtcVideoCodecfunctionDeclared here
resolveWebRtcAudioCodecfunctionDeclared here
detectCodecfunctionDeclared here
detectCodecInMediafunctionDeclared here
decoderCodecIdfunctionDeclared here

Public Static Methods

ReturnNameDescription
std::optional< NegotiatedCodec >negotiateVideo static nodiscardNegotiate the best video codec from a list of offered RTP codec names. Returns the first match that FFmpeg can encode, in preference order: H264 > VP8 > VP9 > AV1 > H265
std::optional< NegotiatedCodec >negotiateAudio static nodiscardNegotiate the best audio codec from a list of offered RTP codec names. Returns the first match that FFmpeg can encode, in preference order: opus > PCMU > PCMA
boolhasEncoder static nodiscardCheck if FFmpeg has an encoder for the given codec name. Accepts both FFmpeg names ("libx264") and RTP names ("H264").
std::stringrtpToFfmpeg static nodiscardMap an RTP codec name to the preferred FFmpeg encoder name. Returns empty string if no mapping exists.
std::stringffmpegToRtp static nodiscardMap an FFmpeg encoder name to the RTP codec name. Returns empty string if no mapping exists.
uint32_tclockRate static nodiscardGet the standard RTP clock rate for a codec.
intdefaultPayloadType static nodiscardGet the default RTP payload type for a codec. Returns 0 for dynamic payload types (caller should assign).
std::optional< CodecSpec >specFromRtp static nodiscardReturn the canonical codec spec for an RTP name, if known.
std::optional< CodecSpec >specFromFfmpeg static nodiscardReturn the canonical codec spec for an FFmpeg encoder name, if known.
std::optional< CodecSpec >specFromVideoCodec static nodiscardResolve the canonical codec spec from an explicit video codec config. Prefers the FFmpeg encoder when present, otherwise falls back to RTP name.
std::optional< CodecSpec >specFromAudioCodec static nodiscardResolve the canonical codec spec from an explicit audio codec config. Prefers the FFmpeg encoder when present, otherwise falls back to RTP name.
CodecSpecrequireVideoSpec static nodiscardResolve a strict canonical video codec spec or throw.
CodecSpecrequireAudioSpec static nodiscardResolve a strict canonical audio codec spec or throw.
av::VideoCodecresolveWebRtcVideoCodec static nodiscardResolve a browser-safe WebRTC video codec config from an explicit codec.
av::AudioCodecresolveWebRtcAudioCodec static nodiscardResolve a browser-safe WebRTC audio codec config from an explicit codec.
std::optional< CodecSpec >detectCodec static nodiscardDetect the first known codec present in an SDP snippet for the given media type.
std::optional< CodecSpec >detectCodecInMedia static nodiscardDetect the first known codec from a structured rtc::Description::Media object for the given media type.
AVCodecIDdecoderCodecId static nodiscardReturn the FFmpeg decoder codec ID for a given codec spec. Returns AV_CODEC_ID_NONE if no mapping is known.

{#negotiatevideo}

negotiateVideo

static nodiscard

[[nodiscard]] static std::optional< NegotiatedCodec > negotiateVideo(const std::vector< std::string > & offeredCodecs)

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:125

Negotiate the best video codec from a list of offered RTP codec names. Returns the first match that FFmpeg can encode, in preference order: H264 > VP8 > VP9 > AV1 > H265


{#negotiateaudio}

negotiateAudio

static nodiscard

[[nodiscard]] static std::optional< NegotiatedCodec > negotiateAudio(const std::vector< std::string > & offeredCodecs)

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:131

Negotiate the best audio codec from a list of offered RTP codec names. Returns the first match that FFmpeg can encode, in preference order: opus > PCMU > PCMA


{#hasencoder}

hasEncoder

static nodiscard

[[nodiscard]] static bool hasEncoder(const std::string & name)

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:135

Check if FFmpeg has an encoder for the given codec name. Accepts both FFmpeg names ("libx264") and RTP names ("H264").


{#rtptoffmpeg}

rtpToFfmpeg

static nodiscard

[[nodiscard]] static std::string rtpToFfmpeg(const std::string & rtpName)

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:139

Map an RTP codec name to the preferred FFmpeg encoder name. Returns empty string if no mapping exists.


{#ffmpegtortp}

ffmpegToRtp

static nodiscard

[[nodiscard]] static std::string ffmpegToRtp(const std::string & ffmpegName)

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:143

Map an FFmpeg encoder name to the RTP codec name. Returns empty string if no mapping exists.


{#clockrate-2}

clockRate

static nodiscard

[[nodiscard]] static uint32_t clockRate(const std::string & rtpName)

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:146

Get the standard RTP clock rate for a codec.


{#defaultpayloadtype}

defaultPayloadType

static nodiscard

[[nodiscard]] static int defaultPayloadType(const std::string & rtpName)

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:150

Get the default RTP payload type for a codec. Returns 0 for dynamic payload types (caller should assign).


{#specfromrtp}

specFromRtp

static nodiscard

[[nodiscard]] static std::optional< CodecSpec > specFromRtp(const std::string & rtpName)

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:154

Return the canonical codec spec for an RTP name, if known.


{#specfromffmpeg}

specFromFfmpeg

static nodiscard

[[nodiscard]] static std::optional< CodecSpec > specFromFfmpeg(const std::string & ffmpegName)

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:158

Return the canonical codec spec for an FFmpeg encoder name, if known.


{#specfromvideocodec}

specFromVideoCodec

static nodiscard

[[nodiscard]] static std::optional< CodecSpec > specFromVideoCodec(const av::VideoCodec & codec)

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:163

Resolve the canonical codec spec from an explicit video codec config. Prefers the FFmpeg encoder when present, otherwise falls back to RTP name.


{#specfromaudiocodec}

specFromAudioCodec

static nodiscard

[[nodiscard]] static std::optional< CodecSpec > specFromAudioCodec(const av::AudioCodec & codec)

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:168

Resolve the canonical codec spec from an explicit audio codec config. Prefers the FFmpeg encoder when present, otherwise falls back to RTP name.


{#requirevideospec}

requireVideoSpec

static nodiscard

[[nodiscard]] static CodecSpec requireVideoSpec(const av::VideoCodec & codec)

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:171

Resolve a strict canonical video codec spec or throw.


{#requireaudiospec}

requireAudioSpec

static nodiscard

[[nodiscard]] static CodecSpec requireAudioSpec(const av::AudioCodec & codec)

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:174

Resolve a strict canonical audio codec spec or throw.


{#resolvewebrtcvideocodec}

resolveWebRtcVideoCodec

static nodiscard

[[nodiscard]] static av::VideoCodec resolveWebRtcVideoCodec(const av::VideoCodec & codec)

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:178

Resolve a browser-safe WebRTC video codec config from an explicit codec.


{#resolvewebrtcaudiocodec}

resolveWebRtcAudioCodec

static nodiscard

[[nodiscard]] static av::AudioCodec resolveWebRtcAudioCodec(const av::AudioCodec & codec)

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:182

Resolve a browser-safe WebRTC audio codec config from an explicit codec.


{#detectcodec}

detectCodec

static nodiscard

[[nodiscard]] static std::optional< CodecSpec > detectCodec(std::string_view sdp, CodecMediaType mediaType)

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:187

Detect the first known codec present in an SDP snippet for the given media type.


{#detectcodecinmedia}

detectCodecInMedia

static nodiscard

[[nodiscard]] static std::optional< CodecSpec > detectCodecInMedia(const rtc::Description::Media & media, CodecMediaType mediaType)

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:192

Detect the first known codec from a structured rtc::Description::Media object for the given media type.


{#decodercodecid}

decoderCodecId

static nodiscard

[[nodiscard]] static AVCodecID decoderCodecId(const CodecSpec & spec)

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:197

Return the FFmpeg decoder codec ID for a given codec spec. Returns AV_CODEC_ID_NONE if no mapping is known.

{#trackhandle}

TrackHandle

#include <icy/webrtc/track.h>
struct TrackHandle

Defined in src/webrtc/include/icy/webrtc/track.h:31

Result of creating a track: the track itself plus its RTP config. Keep the config around - you need it for WebRtcTrackSender.

List of all members

NameKindOwner
trackvariableDeclared here
rtpConfigvariableDeclared here

Public Attributes

ReturnNameDescription
std::shared_ptr< rtc::Track >trackThe libdatachannel track added to the PeerConnection.
std::shared_ptr< rtc::RtpPacketizationConfig >rtpConfigRTP packetization state required by WebRtcTrackSender.

{#track-1}

track

std::shared_ptr< rtc::Track > track

Defined in src/webrtc/include/icy/webrtc/track.h:33

The libdatachannel track added to the PeerConnection.


{#rtpconfig}

rtpConfig

std::shared_ptr< rtc::RtpPacketizationConfig > rtpConfig

Defined in src/webrtc/include/icy/webrtc/track.h:34

RTP packetization state required by WebRtcTrackSender.

{#jitterbufferconfig}

JitterBufferConfig

#include <icy/webrtc/jitterbuffer.h>
struct JitterBufferConfig

Defined in src/webrtc/include/icy/webrtc/jitterbuffer.h:30

Receive-side jitter buffer behaviour for depacketized WebRTC media frames.

The jitter buffer sits after libdatachannel depacketization and before icey emits encoded AudioPacket/VideoPacket objects to downstream decoders or recorders. It reorders frames by RTP-derived media timestamp and delays release long enough to absorb moderate network jitter.

List of all members

NameKindOwner
enabledvariableDeclared here
minDelayMsvariableDeclared here
maxDelayMsvariableDeclared here
adaptiveFactorvariableDeclared here
tickIntervalMsvariableDeclared here

Public Attributes

ReturnNameDescription
boolenabledFalse keeps the current zero-buffer receive path.
std::int64_tminDelayMsBase playout delay in milliseconds.
std::int64_tmaxDelayMsUpper bound for the adaptive playout delay.
doubleadaptiveFactorExtra delay multiplier applied to observed inter-arrival variance.
std::int64_ttickIntervalMsPoll interval for releasing buffered frames.

{#enabled-1}

enabled

bool enabled = false

Defined in src/webrtc/include/icy/webrtc/jitterbuffer.h:32

False keeps the current zero-buffer receive path.


{#mindelayms}

minDelayMs

std::int64_t minDelayMs = 20

Defined in src/webrtc/include/icy/webrtc/jitterbuffer.h:33

Base playout delay in milliseconds.


{#maxdelayms}

maxDelayMs

std::int64_t maxDelayMs = 120

Defined in src/webrtc/include/icy/webrtc/jitterbuffer.h:34

Upper bound for the adaptive playout delay.


{#adaptivefactor}

adaptiveFactor

double adaptiveFactor = 1.5

Defined in src/webrtc/include/icy/webrtc/jitterbuffer.h:35

Extra delay multiplier applied to observed inter-arrival variance.


{#tickintervalms}

tickIntervalMs

std::int64_t tickIntervalMs = 5

Defined in src/webrtc/include/icy/webrtc/jitterbuffer.h:36

Poll interval for releasing buffered frames.

{#codecspec}

CodecSpec

#include <icy/webrtc/codecnegotiator.h>
struct CodecSpec

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:65

Canonical description of a codec supported by icey's WebRTC helpers.

List of all members

NameKindOwner
idvariableDeclared here
mediaTypevariableDeclared here
rtpNamevariableDeclared here
ffmpegNamevariableDeclared here
clockRatevariableDeclared here
payloadTypevariableDeclared here
fmtpvariableDeclared here
validfunctionDeclared here

Public Attributes

ReturnNameDescription
CodecIdidStable codec identifier.
CodecMediaTypemediaTypeAudio or video media kind.
std::stringrtpNameCanonical RTP codec name.
std::stringffmpegNamePreferred FFmpeg encoder name.
uint32_tclockRateRTP clock rate in Hz.
intpayloadTypeDefault static or preferred dynamic payload type.
std::stringfmtpCanonical fmtp line for SDP generation.

{#id-10}

id

CodecId id = 

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:67

Stable codec identifier.


{#mediatype}

mediaType

CodecMediaType mediaType = 

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:68

Audio or video media kind.


{#rtpname}

rtpName

std::string rtpName

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:69

Canonical RTP codec name.


{#ffmpegname}

ffmpegName

std::string ffmpegName

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:70

Preferred FFmpeg encoder name.


{#clockrate}

clockRate

uint32_t clockRate = 0

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:71

RTP clock rate in Hz.


{#payloadtype}

payloadType

int payloadType = 0

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:72

Default static or preferred dynamic payload type.


{#fmtp}

fmtp

std::string fmtp

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:73

Canonical fmtp line for SDP generation.

Public Methods

ReturnNameDescription
boolvalid const inline nodiscard

{#valid-18}

valid

const inline nodiscard

[[nodiscard]] inline bool valid() const

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:75

{#negotiatedcodec}

NegotiatedCodec

#include <icy/webrtc/codecnegotiator.h>
struct NegotiatedCodec

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:81

Result of codec negotiation between a remote SDP offer and the local FFmpeg codec inventory.

List of all members

NameKindOwner
rtpNamevariableDeclared here
ffmpegNamevariableDeclared here
payloadTypevariableDeclared here
clockRatevariableDeclared here
fmtpvariableDeclared here
toVideoCodecfunctionDeclared here
toWebRtcVideoCodecfunctionDeclared here
toAudioCodecfunctionDeclared here
toWebRtcAudioCodecfunctionDeclared here

Public Attributes

ReturnNameDescription
std::stringrtpNameRTP codec name (e.g. "H264", "VP8", "opus").
std::stringffmpegNameFFmpeg encoder name (e.g. "libx264", "libvpx", "libopus").
intpayloadTypeRTP payload type from SDP.
uint32_tclockRateRTP clock rate (90000 for video, 48000 for opus).
std::stringfmtpFormat parameters (e.g. "profile-level-id=42e01f").

{#rtpname-1}

rtpName

std::string rtpName

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:83

RTP codec name (e.g. "H264", "VP8", "opus").


{#ffmpegname-1}

ffmpegName

std::string ffmpegName

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:84

FFmpeg encoder name (e.g. "libx264", "libvpx", "libopus").


{#payloadtype-1}

payloadType

int payloadType = 0

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:85

RTP payload type from SDP.


{#clockrate-1}

clockRate

uint32_t clockRate = 0

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:86

RTP clock rate (90000 for video, 48000 for opus).


{#fmtp-1}

fmtp

std::string fmtp

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:87

Format parameters (e.g. "profile-level-id=42e01f").

Public Methods

ReturnNameDescription
av::VideoCodectoVideoCodec const nodiscardCreate an av::VideoCodec from this negotiation result. Width, height, fps default to 0 (caller should set these).
av::VideoCodectoWebRtcVideoCodec const nodiscardCreate an av::VideoCodec configured for WebRTC browser playback. Sets low-latency options: ultrafast preset, zerolatency tune, constrained baseline profile for H.264, and appropriate defaults for VP8/VP9/AV1.
av::AudioCodectoAudioCodec const nodiscardCreate an av::AudioCodec from this negotiation result. Channels default to 2, sampleRate to the RTP clock rate.
av::AudioCodectoWebRtcAudioCodec const nodiscardCreate an av::AudioCodec configured for WebRTC browser playback. Forces 48000 Hz for Opus, sets appropriate options.

{#tovideocodec}

toVideoCodec

const nodiscard

[[nodiscard]] av::VideoCodec toVideoCodec(int width = 0, int height = 0, double fps = 0.0) const

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:91

Create an av::VideoCodec from this negotiation result. Width, height, fps default to 0 (caller should set these).


{#towebrtcvideocodec}

toWebRtcVideoCodec

const nodiscard

[[nodiscard]] av::VideoCodec toWebRtcVideoCodec(int width = 0, int height = 0, double fps = 0.0) const

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:98

Create an av::VideoCodec configured for WebRTC browser playback. Sets low-latency options: ultrafast preset, zerolatency tune, constrained baseline profile for H.264, and appropriate defaults for VP8/VP9/AV1.


{#toaudiocodec}

toAudioCodec

const nodiscard

[[nodiscard]] av::AudioCodec toAudioCodec(int channels = 2, int sampleRate = 0) const

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:103

Create an av::AudioCodec from this negotiation result. Channels default to 2, sampleRate to the RTP clock rate.


{#towebrtcaudiocodec}

toWebRtcAudioCodec

const nodiscard

[[nodiscard]] av::AudioCodec toWebRtcAudioCodec(int channels = 2) const

Defined in src/webrtc/include/icy/webrtc/codecnegotiator.h:108

Create an av::AudioCodec configured for WebRTC browser playback. Forces 48000 Hz for Opus, sets appropriate options.