WebRTC module

NegotiatedCodec

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

NegotiatedCodec

#include <icy/webrtc/codecnegotiator.h>

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

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

std::string rtpName

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


ffmpegName

std::string ffmpegName

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


payloadType

int payloadType = 0

RTP payload type from SDP.


clockRate

uint32_t clockRate = 0

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


fmtp

std::string fmtp

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

Public Methods

ReturnNameDescription
av::VideoCodectoVideoCodec constCreate an av::VideoCodec from this negotiation result. Width, height, fps default to 0 (caller should set these).
av::VideoCodectoWebRtcVideoCodec constCreate 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 constCreate an av::AudioCodec from this negotiation result. Channels default to 2, sampleRate to the RTP clock rate.
av::AudioCodectoWebRtcAudioCodec constCreate an av::AudioCodec configured for WebRTC browser playback. Forces 48000 Hz for Opus, sets appropriate options.

toVideoCodec

const

av::VideoCodec toVideoCodec(int width, int height, double fps) const

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


toWebRtcVideoCodec

const

av::VideoCodec toWebRtcVideoCodec(int width, int height, double fps) const

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

const

av::AudioCodec toAudioCodec(int channels, int sampleRate) const

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


toWebRtcAudioCodec

const

av::AudioCodec toWebRtcAudioCodec(int channels) const

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