Skip to content

Commit e39ae52

Browse files
committed
Realtime: replaced ridUnavailableStrategy with ridNotAvailable and other improvements
1 parent c1c7815 commit e39ae52

File tree

2 files changed

+29
-30
lines changed

2 files changed

+29
-30
lines changed

public/realtime/static/calls-api-2024-05-21.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ paths:
150150
simulcast:
151151
preferredRid: "h"
152152
priorityOrdering: "asciibetical"
153-
ridUnavailableStrategy: "nextPriority"
153+
ridNotAvailabl: "asciibetical"
154154
security:
155155
- secret: []
156156
parameters:
@@ -228,7 +228,7 @@ paths:
228228
simulcast:
229229
preferredRid: "h"
230230
priorityOrdering: "asciibetical"
231-
ridUnavailableStrategy: "nextPriority"
231+
ridNotAvailabl: "asciibetical"
232232
sessionDescription:
233233
sdp: |
234234
v=0
@@ -396,7 +396,7 @@ paths:
396396
simulcast:
397397
preferredRid: "h"
398398
priorityOrdering: "asciibetical"
399-
ridUnavailableStrategy: "nextPriority"
399+
ridNotAavailable: "asciibetical"
400400
security:
401401
- secret: []
402402
parameters:
@@ -530,13 +530,13 @@ components:
530530
- asciibetical
531531
default: none
532532
description: Controls what happens if there is not enough network resources available to send the preferredRid. 'none' means keep sending even if not enough bandwidth, 'asciibetical' uses a-z order to determine priority where a is most desirable and z is least desirable.
533-
ridUnavailableStrategy:
533+
ridNotAvailable:
534534
type: string
535535
enum:
536536
- none
537-
- nextPriority
537+
- asciibetical
538538
default: none
539-
description: Controls what happens when the rid currently being used or preferredRid is no longer being sent by the publisher. 'none' means do nothing, 'nextPriority' uses the next on the priorityOrdering.
539+
description: Controls what happens when the rid currently being used or preferredRid is no longer being sent by the publisher. 'none' means do nothing, 'asciibetical' uses the next available layer after sorting the layers a-z.
540540
CloseTrackObject:
541541
type: object
542542
properties:

src/content/docs/realtime/simulcast.mdx

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ sidebar:
55
order: 8
66
---
77

8-
Simulcast is a feature of WebRTC that allows a publisher to send multiple streams of the same media at different qualities. For example, this is useful for scenarios where you want to send a high quality stream for desktop users and a lower quality stream for mobile users.
8+
Simulcast is a feature of WebRTC that allows a publisher to send multiple video streams of the same media at different qualities. For example, this is useful for scenarios where you want to send a high quality stream for desktop users and a lower quality stream for mobile users.
99

1010
```mermaid
1111
graph LR
12-
A[Publisher] -->|Low quality| B[Cloudflare Calls SFU]
12+
A[Publisher] -->|Low quality| B[Cloudflare Realtime SFU]
1313
A -->|Medium quality| B
1414
A -->|High quality| B
1515
B -->|Low quality| C@{ shape: procs, label: "Subscribers"}
@@ -20,28 +20,27 @@ B -->|High quality| E@{ shape: procs, label: "Subscribers"}
2020

2121
### How it works
2222

23-
Simulcast in WebRTC allows a single media source, like a camera or screen share, to be encoded at multiple quality levels and sent simultaneously, which is beneficial for subscribers with varying network conditions and device capabilities. The media source is encoded into multiple streams, each identified by RIDs (RTP Stream Identifiers) for different quality levels, such as low, medium, and high. These simulcast streams are described in the SDP you send to Cloudflare Calls SFU. It's the responsibility of the Cloudflare Calls SFU to ensure that the appropriate quality stream is delivered to each subscriber based on their network conditions and device capabilities.
23+
Simulcast in WebRTC allows a single video source, like a camera or screen share, to be encoded at multiple quality levels and sent simultaneously, which is beneficial for subscribers with varying network conditions and device capabilities. The video source is encoded into multiple streams, each identified by RIDs (RTP Stream Identifiers) for different quality levels, such as low, medium, and high. These simulcast streams are described in the SDP you send to Cloudflare Realtime SFU. It's the responsibility of the Cloudflare Realtime SFU to ensure that the appropriate quality stream is delivered to each subscriber based on their network conditions and device capabilities.
2424

25-
Cloudflare Calls SFU will automatically handle the simulcast configuration based on the SDP you send to it from the publisher. The SFU will then automatically switch between the different quality levels based on the subscriber's network conditions. You can control the quality switching behavior using the `simulcast` configuration object when you send an API call to start pulling a remote track.
25+
Cloudflare Realtime SFU will automatically handle the simulcast configuration based on the SDP you send to it from the publisher. The SFU will then automatically switch between the different quality levels based on the subscriber's network conditions, or the qaulity level can be controlled manually via the API. You can control the quality switching behavior using the `simulcast` configuration object when you send an API call to start pulling a remote track.
2626

2727
### Quality Control
2828

2929
The `simulcast` configuration object in the API call when you start pulling a remote track allows you to specify:
3030

31-
- `preferredRid`: The preferred stream (RID for the simulcast stream. [RIDs can be specified by the publisher.](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpSender/setParameters#encodings))
32-
- `priorityOrdering`: Controls how the SFU handles bandwidth constraints
33-
- `none`: Keep sending the preferred layer even if there's not enough bandwidth
34-
- `asciibetical`: Use alphabetical ordering (a-z) to determine priority, where 'a' is most desirable and 'z' is least desirable
35-
- `ridUnavailableStrategy`: Controls what happens when the preferred RID is no longer available, for example when the publisher stops sending it
36-
37-
- `none`: Do nothing
38-
- `nextPriority`: Switch to the next available RID based on the priority ordering
31+
- `preferredRid`: The preferred quality level for the video stream (RID for the simulcast stream. [RIDs can be specified by the publisher.](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpSender/setParameters#encodings))
32+
- `priorityOrdering`: Controls how the SFU handles bandwidth constraints.
33+
- `none`: Keep sending the preferred layer, set via the preferredRid, even if there's not enough bandwidth.
34+
- `asciibetical`: Use alphabetical ordering (a-z) to determine priority, where 'a' is most desirable and 'z' is least desirable.
35+
- `ridNotAvailable`: Controls what happens when the preferred RID is no longer available, for example when the publisher stops sending it.
36+
- `none`: Do nothing.
37+
- `asciibetical`: Switch to the next available RID based on the priority ordering, where 'a' is most desirable and 'z' is least desirable.
3938

4039
You will likely want to order the asciibetical RIDs based on your desired metric, such as higest resoltion to lowest or highest bandwidth to lowest.
4140

4241
### Bandwidth Management across media tracks
4342

44-
Cloudflare Calls treats all media tracks equally at the transport level. For example, if you have multiple video tracks (cameras, screen shares, etc.), they all have equal priority for bandwidth allocation. This means:
43+
Cloudflare Realtime treats all media tracks equally at the transport level. For example, if you have multiple video tracks (cameras, screen shares, etc.), they all have equal priority for bandwidth allocation. This means:
4544

4645
1. Each track's simulcast configuration is handled independently
4746
1. The SFU performs automatic bandwidth estimation and layer switching based on network conditions independently for each track
@@ -50,9 +49,8 @@ Cloudflare Calls treats all media tracks equally at the transport level. For exa
5049

5150
When a layer switch is requested (through updating `preferredRid`) with the `/tracks/update` API:
5251

53-
1. The SFU will automatically generate a Picture Loss Indication (PLI)
54-
2. Layer switching only occurs when a keyframe arrives on the target layer
55-
3. PLI generation is debounced to prevent excessive requests
52+
1. The SFU will automatically generate a Full Intraframe Request (FIR)
53+
2. PLI generation is debounced to prevent excessive requests
5654

5755
### Publisher Configuration
5856

@@ -65,23 +63,24 @@ a=rid:h send
6563
a=rid:q send
6664
```
6765

68-
You can include these by specifying `sendEncodings` when creating the transceiver:
66+
If the publisher endpoint is a browser you can include these by specifying `sendEncodings` when creating the transceiver like this:
6967

7068
```js
7169
const transceiver = peerConnection.addTransceiver(track, {
7270
direction: "sendonly",
7371
sendEncodings: [
74-
{ scaleResolutionDownBy: 1, rid: "a" },
75-
{ scaleResolutionDownBy: 2, rid: "b" },
76-
{ scaleResolutionDownBy: 4, rid: "c" }
72+
{ scaleResolutionDownBy: 1, rid: "f" },
73+
{ scaleResolutionDownBy: 2, rid: "h" },
74+
{ scaleResolutionDownBy: 4, rid: "q" }
7775
]
7876
});
77+
```
7978
## Example
8079

81-
Here's an example of how to use simulcast with Cloudflare Calls:
80+
Here's an example of how to use simulcast with Cloudflare Realtime:
8281

8382
1. Create a new local track with simulcast configuration. There should be a section in the SDP with `a=simulcast:send`.
84-
2. Use the [Cloudflare Calls API](/calls/https-api) to push this local track, by calling the /tracks/new endpoint.
85-
3. Use the [Cloudflare Calls API](/calls/https-api) to start pulling a remote track (from another browser or device), by calling the /tracks/new endpoint and specifying the `simulcast` configuration object along with the remote track ID you get from step 2.
83+
2. Use the [Cloudflare Realtime API](/realtime/https-api) to push this local track, by calling the /tracks/new endpoint.
84+
3. Use the [Cloudflare Realtime API](/realtime/https-api) to start pulling a remote track (from another browser or device), by calling the /tracks/new endpoint and specifying the `simulcast` configuration object along with the remote track ID you get from step 2.
8685

87-
For more examples, check out the [Calls Examples GitHub repository](https://github.com/cloudflare/calls-examples/tree/main/simulcast).
86+
For more examples, check out the [Realtime Examples GitHub repository](https://github.com/cloudflare/calls-examples/tree/main/simulcast).

0 commit comments

Comments
 (0)