You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 239d6d2
Browse filesBrowse the repository at this point in the historyBrowse files
feat: map the remaining sender encoding parameters (#316)
RTCRtpEncodingParameters gains the encoding parameters WebRTC has and the
Java API did not: rid for simulcast, scaleResolutionDownTo (with the new
RTCResolutionRestriction), scalabilityMode and numTemporalLayers for SVC,
bitratePriority and networkPriority, adaptivePtime for audio, and codec to
send an encoding with a codec of its own. RTCRtpSendParameters gains
degradationPreference, with the new RTCDegradationPreference.
RTCRtpCodecCapability gains getScalabilityModes(), the modes a codec
supports, which is what scalabilityMode accepts; unsupported modes make
setParameters() fail. The priorities apply to the whole sender, and WebRTC
accepts them on the first encoding only, which the Javadoc says.
The media constraints guide covers the new parameters, with simulcast and
scalability modes.
Copy file name to clipboardExpand all lines: docs/guide/media/constraints.md
+83Lines changed: 83 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -113,6 +113,89 @@ The `scaleResolutionDownBy` parameter specifies how much to scale down the video
113
113
Note that these constraints are applied without requiring SDP renegotiation, making them suitable for dynamic adaptation to changing network conditions.
114
114
:::
115
115
116
+
To cap the resolution at an absolute size instead, set `scaleResolutionDownTo`. The video is scaled down to fit, whatever size the source delivers; it takes precedence over `scaleResolutionDownBy` if both are set.
When the network or the CPU cannot keep up, a video sender lowers either its frame rate or its resolution. `degradationPreference` on the send parameters decides which:
|`MAINTAIN_FRAMERATE`| Resolution; suits motion, such as camera video |
139
+
|`MAINTAIN_RESOLUTION`| Frame rate; suits detail, such as screens with text |
140
+
|`BALANCED`| Both, in turns |
141
+
|`MAINTAIN_FRAMERATE_AND_RESOLUTION`| Neither; frames are dropped instead |
142
+
143
+
If unset, WebRTC keeps the resolution of screen shares and of tracks hinted as detailed or text, and the frame rate of other video.
144
+
145
+
## Simulcast
146
+
147
+
With simulcast, a video sender encodes the same video several times, at different resolutions, so that a server can forward to each receiver the one its connection can take. The encodings are given when the transceiver is created, each with an RTP stream ID (`rid`):
The `rid`s cannot be changed afterwards; the other parameters of each encoding can, through `setParameters()`, e.g. `active = false` to pause one of them. An encoding may also send a different codec than the others, by setting its `codec` to one of the negotiated codecs.
173
+
174
+
## Scalability Modes (SVC)
175
+
176
+
Instead of separate encodings, one encoding can carry layers, which a server can drop to lower the rate: temporal layers (fewer frames per second) and, with VP9 and AV1, spatial layers (lower resolutions). `scalabilityMode` takes the mode names of the [WebRTC SVC specification](https://www.w3.org/TR/webrtc-svc/), e.g. `L1T3` for three temporal layers, or `L3T3_KEY` for three spatial layers with three temporal layers each:
The codec has to support the mode; `setParameters()` throws otherwise. `getScalabilityModes()` of a codec's capability, from `factory.getRtpSenderCapabilities(MediaType.VIDEO)`, lists the modes it supports. VP8 supports temporal layers only.
185
+
186
+
## Priorities
187
+
188
+
`bitratePriority` sets the share of the available bitrate a sender gets relative to the other senders of the peer connection (default 1.0), and `networkPriority` how its packets are marked on the network (DSCP), where the network honors it. Both apply to the whole sender, so only the first encoding may set them:
0 commit comments