WebRTC configuration reference

Once WebRTC is enabled for an application, you can tune its behavior with properties in the application's Application.xml file. Properties in the <WebRTC> container control STUN and TURN servers, ICE restart, WebSocket signaling, WHIP and WHEP bearer tokens, simulcast and rendition selection, RTP retransmission (RTX), NACK feedback, FIR messaging, PLI intervals, transport-wide congestion control, data channels, codec updates, and session idle timeout. Properties in the <RTP> container control the jitter buffer used to recover out-of-order and retransmitted packets, packet loss logging, and the H.264 constraints advertised in the SDP. To enable them in your app's configuration file, open [install-dir]/conf/[app-name]/Application.xml.

WebRTC works with the defaults, but you may configure these optional settings to fine-tune your configuration.

WebRTC element properties

In the <WebRTC>/<Properties> container, add any of these properties (Name, Type, Value) in the following format:

<Property>
	<Name>...</Name>
	<Value>...</Value>
	<Type>...</Type>
</Property>

STUN and TURN

Configure the servers WSE uses to discover its public address and, where a direct path isn't available, to relay media.

Name Type Description
harvestStunServer String The address of the STUN server.
harvestTurnRelay String The TURN relay server, in the following format: turn:host:port. You can configure the TURN relay server to use UDP, TCP or TLS based on the value provided.
  • UDP: turn:198.51.100.10:3478
  • TCP: turn:198.51.100.10:3478?transport=tcp
  • TLS: turns:turn.example.com:443?transport=tcp
harvestTurnRelayUsername String The username for the TURN server.
harvestTurnRelayPassword String The password for the TURN server.

Signaling and endpoints

Control how publishers and players negotiate a session with WSE.

Name Type Description
webrtcEnableWebSocket Boolean Set to false to turn off WebSocket signaling. (Default: true, so upgraded applications keep WebSocket signaling.)
webrtcWhipBearerToken String The WHIP bearer token.
webrtcWhepBearerToken String The WHEP bearer token.

ICE restart

Control whether WSE accepts a renegotiation of the candidate pair when a connection's network path changes, such as when a viewer moves from Wi-Fi to cellular.

Name Type Description
iceRestartEnabled Boolean When set to false, a restart offer is rejected and the connection is left on its existing pair. (Default: true)
iceRestartTimeoutMs Long The time WSE waits for the pending agent to reach connectivity before aborting the restart, in milliseconds. (Default: 15000)

Simulcast

Control how WSE matches each viewer to one of the renditions a simulcast publisher sends. Simulcast is enabled by default for all WebRTC streams.

Name Type Description
webrtcEnableSimulcast Boolean Set to false to disable simulcast (multi-rendition) support. (Default: true)
webrtcRenditionSelector String The rendition selection strategy. May be either of the following:
  • highestPriority: Send viewers the highest encoding, dropping if necessary. (Default)
  • bandwidth: Determine the optimal rendition from each viewer's estimated bandwidth. Selection uses each encoding's measured bitrate, so a newly started rendition is skipped until a measurement is available.
Unknown values fall back to highestPriority and a warning will be logged.
webrtcRenditionSwitchRequestKeyframe Boolean Set to true to request a keyframe when a rendition switches. Set to false to wait for the next natural keyframe. (Default: true)
webrtcRenditionInitialRendition String The rendition a viewer initially receives. May be either of the following:
  • lowest: Start at the lowest quality and climb as bandwidth is confirmed. Avoids an initial stall. (Default)
  • highest: Start at top quality and drop if unsustainable. Avoids a blurry-to-sharp ramp.
Applies only when webrtcRenditionSelector is bandwidth.
webrtcRenditionUpgradeMarginPercent Double The headroom above a rendition's required bitrate that the estimate must exceed before upgrading to it, as a percentage. Upgrades apply as soon as the estimate clears the target's bitrate plus the margin, with no debounce. Smaller values make upgrades easier. Applies only when webrtcRenditionSelector is bandwidth. (Default: 5.0)
webrtcRenditionDowngradeMarginPercent Double The headroom below the current rendition's required bitrate that the estimate must fall past before downgrading from it, as a percentage. Larger values make downgrades more reluctant. Must be strictly greater than webrtcRenditionUpgradeMarginPercent. Applies only when webrtcRenditionSelector is bandwidth. (Default: 15.0)
webrtcRenditionDowngradeDebounceMs Long The debounce window before a downgrade takes effect, in milliseconds. Only downgrades wait for this timer; upgrades happen immediately. Applies only when webrtcRenditionSelector is bandwidth. (Default: 2000)

NACK and RTX

Repair isolated packet loss by retransmitting the individual missing packets, instead of escalating to a keyframe request. Both properties are disabled by default.

WSE applies NACK/RTX in both directions, taking the role each connection calls for: it requests retransmissions from a publisher and serves them to a viewer.

Note: These properties are separate from the <RTP> container's useNack property, which works with the jitter buffer. Setting one does not set the other.

Name Type Description
webrtcEnableNACK Boolean Set to true to enable RTCP NACK feedback, which lets a receiver report the individual sequence numbers it missed instead of escalating to a keyframe request. (Default: false)
webrtcNackDelayMs Integer How long to wait after detecting a gap before requesting the missing packets, in milliseconds. A short delay lets merely reordered packets arrive on their own, avoiding requests for packets that were never lost. Must be between 0 and 20. Values outside this range will be clamped to the nearest bound and a warning will be logged. (Default: 2)
webrtcEnableRTX Boolean Set to true to enable RTP retransmission, which serves the reported packets from a cache over a parallel stream, leaving the primary stream undisturbed. (Default: false)
webrtcRTXCacheSize Integer The number of recently sent packets held available for retransmission. Requests for packets that have already left the cache go unserved. Because the cache is measured in packets rather than in time, the same size covers a shorter span of the stream at higher bitrates. Must be between 1 and 2000. Values outside of this range will be clamped to the nearest bound and a warning will be logged. (Default: 1000)

Keyframe requests

Recover a decoder that can no longer decode what it's receiving. Keyframe request handling is enabled by default for all WebRTC streams.

Name Type Description
webrtcPLIInterval Long The minimum time between PLI requests forwarded to the publisher, in milliseconds. Requests that arrive inside the interval are absorbed, so a burst of viewer requests results in a single keyframe. Lower values shorten recovery time; higher values reduce encoder load. Must be between 100 and 60000. (Default: 3000)
webrtcFIRMessageScheme String The pacing scheme for Full Intra Request (FIR) messages. May be either of the following:
  • time: Pace FIR messages by elapsed time. (Default)
  • frame: Pace FIR messages by frame count.
FIR messages are enabled by default and add resiliency to packet loss while publishing.

Applies to WSE v4.11.3 and earlier.
webrtcFIRMessageInterval Integer The minimum interval between FIR messages, interpreted in milliseconds when webrtcFIRMessageScheme is time and in frames when it's frame. Must be between 1 and 60000. (Default: 1000)

Applies to WSE v4.11.3 and earlier.

Bandwidth estimation

Name Type Description
webrtcEnableRemb Boolean Set to false to disable REMB feedback on the video section. (Default: true)
webrtcEnableTransportCC Boolean Set to false to disable transport-wide congestion control (TWCC). (Default: true)

Data channels

Control whether WSE opens data channels alongside media, and how messages on those channels are routed.

Name Type Description
webrtcEnableDataChannels Boolean Set to true to enable data channels for the application. (Default: false)
webrtcDataChannelMode String May be set to:
  • BROADCAST: WSE-initiated push, publisher-centered. WSE fans out a publisher's messages to the connected peers on its own.
  • MODULE: Application-owned topology. WSE applies no routing of its own. Channels stay point-to-point with that connection's peer, and any fan-out is module logic.
(Default: BROADCAST)
webrtcDataChannelMaxPendingDispatchMessages Integer The per-connection bound on queued module message callbacks. Available in MODULE mode only. Must be between 1 and 65536. (Default: 512)

Codecs and session behavior

Name Type Description
webrtcCodecUpdates Boolean Allow codec updates to pass through. Can cause frequent onCodecInfoVideo calls on IMediaStreamActionNotify3, depending on the source encoder. (Default: true)
webrtcIdleTimeout Integer Milliseconds before a session closes with no publish/playback activity. Must be between 1000 and 3600000. (Default: 30000)

WebRTC element example

<WebRTC>
    <!-- Enable WebRTC publishing to this application -->
    <EnablePublish>true</EnablePublish>
    <!-- Enable WebRTC playback from this application -->
    <EnablePlay>true</EnablePlay>
    <!-- Enable query of published stream names for this application -->
    <EnableQuery>true</EnableQuery>
    <!-- IP address, transport, and port used for WebRTC streaming. -->
    <!-- TCP format: [external-ip-address],tcp,[port]   UDP format: [external-ip-address],udp -->
    <IceCandidateIpAddresses>13.218.92.124,udp|13.218.92.124,tcp,1935</IceCandidateIpAddresses>
    <!-- Local IP of the network card to use for WebRTC UDP traffic -->
    <UDPBindAddress/>
    <!-- Audio codecs, in order of preference, for ingestion -->
    <PreferredCodecsAudio>opus,pcmu,pcma</PreferredCodecsAudio>
    <!-- Video codecs, in order of preference, for ingestion -->
    <PreferredCodecsVideo>vp8,h264</PreferredCodecsVideo>
    <!-- Enable WebRTC debug logging -->
    <DebugLog>false</DebugLog>
    <Properties>
        <Property>
            <Name>harvestStunServer</Name>
            <Value>stun.l.google.com:19302</Value>
            <Type>String</Type>
        </Property>
        <Property>
            <Name>harvestTurnRelay</Name>
            <Value>turn:turn.example.com:3478</Value>
            <Type>String</Type>
        </Property>
        <Property>
            <Name>harvestTurnRelayUsername</Name>
            <Value>turnuser</Value>
            <Type>String</Type>
        </Property>
        <Property>
            <Name>harvestTurnRelayPassword</Name>
            <Value>turnpassword</Value>
            <Type>String</Type>
        </Property>
        <Property>
            <Name>webrtcWhipBearerToken</Name>
            <Value>79273a6f03772d162eec9ff2f1218dde</Value>
            <Type>String</Type>
        </Property>
        <Property>
            <Name>webrtcWhepBearerToken</Name>
            <Value>5c1f0b9a8d4e47a2b6c3f9e1d7a2b8c4</Value>
            <Type>String</Type>
        </Property>
    </Properties>
</WebRTC>

RTP element properties

In the <RTP>/<Properties> container, add any of these properties (Name, Type, Value) in the following format:

<Property>
	<Name>...</Name>
	<Value>...</Value>
	<Type>...</Type>
</Property>

Jitter buffer and packet loss

Buffer incoming RTP so that out-of-order and retransmitted packets can be put back in sequence, and log what the buffer recovers.

Note: useNack requires the jitter buffer and is separate from the <WebRTC> container's webrtcEnableNACK property. Setting one does not set the other.

Name Type Description
rtpDePacketizerWrapper String Set to com.wowza.wms.rtp.depacketizer.JitterBuffer to enable a jitter buffer for out-of-order/retransmitted packets. Recommended for UDP; adds delay. Required for useNack.
jitterBufferDelay Integer Jitter buffer delay (ms). If useNack is true, ~2× RTT plus overhead; if false, 100. (Default 500)
useNack Boolean Send NACK messages for retransmission of lost packets (WebRTC only). Recommended for UDP; adds delay; requires the jitter buffer. (Default false)
jitterBufferDebug Boolean Log out-of-order packets recovered in time, including recovery duration. (Default false)
logPacketLoss Boolean Log packets lost and not recovered in time. (Default false)

H.264 constraints

Override the H.264 profile constraints WSE advertises in the SDP, to help play streams from encoders that send inconsistent codec data.

Name Type Description
rtpForceH264Constraint Boolean Allow the returned SDP to use different H.264 constraints than the stream. (Default false)
rtpForceH264ConstraintValue Integer H.264 constraint value when rtpForceH264Constraint is true. Default 192; also 128, 224, 240.
rtpUseLowestH264Constraint or rtpUseHighestH264Constraint Boolean Use the lowest or highest value when determining the H.264 profile in the SDP, to help play streams from encoders that send inconsistent codec data. Can't both be used; if both true, highest wins.

RTP element example

<RTP>
    <!-- RTP/Authentication/[type]Methods defined in Authentication.xml. Default setup includes: none, basic, digest -->
    <Authentication>
        <PublishMethod>none</PublishMethod>
        <PlayMethod>none</PlayMethod>
    </Authentication>
    <!-- RTP/AVSyncMethod. Valid values are: senderreport, systemclock, rtptimecode -->
    <AVSyncMethod>senderreport</AVSyncMethod>
    <MaxRTCPWaitTime>12000</MaxRTCPWaitTime>
    <IdleFrequency>75</IdleFrequency>
    <RTSPSessionTimeout>90000</RTSPSessionTimeout>
    <RTSPMaximumPendingWriteBytes>0</RTSPMaximumPendingWriteBytes>
    <RTSPBindIpAddress></RTSPBindIpAddress>
    <RTSPConnectionIpAddress>0.0.0.0</RTSPConnectionIpAddress>
    <RTSPOriginIpAddress>127.0.0.1</RTSPOriginIpAddress>
    <IncomingDatagramPortRanges>*</IncomingDatagramPortRanges>
    <!-- Properties defined here will override any properties defined in conf/RTP.xml for any depacketizers loaded by this application -->
    <Properties>
    </Properties>
</RTP>