-
Notifications
You must be signed in to change notification settings - Fork 10k
Calls: Introduce simulcast API #20371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Preview URL: https://2b5ea9a9.preview.developers.cloudflare.com Files with changes (up to 15)
|
|
Some initial quick points: Example 4 is not what we had been discussing. When you push a track the Should we use /track/change or /track/update? Regarding the open question "I REALLY want the RID I just told you, but if the RID is no longer being published, then downgrade. However I'm okay with packet loss with a higher rid I can't handle":
|
This is an oversight from my side. What I mean was new remote track with simulcast capabilities, not local. When you pull a brand new track, there should be an option to specify simulcast options though. We can't just depend on the change endpoint to handle simulcast.
I'm leaning towards erroring because it's a blatant issue with the API definition, push with simulcast doesn't make sense.
I would also prefer PUT at
What if you wanted to ignore all bandwidth estimation changes but keep the changes when a rid disappears entirely? |
Yes when you pull a new track the /track/new endpoint will support the
Okay.
Great. We already have PUT for
Ahh. Yeah I think that scenario highlights your concern if we need two different parameters:
|
|
Do you agree we have a consensus about the HTTP method and endpoint? curl -X PUT "https://rtc.live.cloudflare.com/v1/apps/YOUR_APP_ID/sessions/e017a2629c754fedc1f7d8587e06d126/tracks/update" |
|
Regarding the request body I lean towards having schema/TracksRequest for it OR a subset of it that does not include the sdp and autoDiscover fields. TracksRequest/subset should be updated to have the simulcast field The subset could be look like: and TrackObject should have the recently added simulcast field |
|
In relation to the simulcast field:
|
This is already reflected in https://github.com/cloudflare/cloudflare-docs/pull/20371/files#diff-dfab4b0d8e0e3e2d7230fcf1c1ac833de68f48d0512d9b956781a594c5b5549bR506. Were you thinking of something else? Updating the PR now to make the corrections we discussed. |
Shouldn't this be called Because imagine a scenario where there are many tiny users on screen. The client can set "send me simulcast that is maxWidth 180x180. Then if this criteria fails (say there isn't a layer that is this small), what would we do? Is this API expressive enough for this kind of case? |
Several points on this:
|
nils-ohlmeier
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think overall it looks good. Quite a few details still to figure out.
| simulcast: | ||
| preferredRid: "h" | ||
| fallbackStrategy: "leastBandwidth" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was not planing on echoing back in the response the simulcast parameters.
What is the use case or advantage of doing that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no advantage. can remove 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but maybe echo shows it is applied? example we'd not echo if not a simulcast track?
| trackID1: | ||
| mid: "7" | ||
| sessionId: "2a45361d5fd7cc14eface0587c276c94" | ||
| trackName: "new-track-name" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the new-track-name only apply to the use case of replacing a track?
For the simulcast scenario the track stays the same. So I assumed we would not return a trackName in that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should try to return what we have here. I don't see why returning is a bad thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think "new-track-name" is confusing. It's fine to keep trackName though IMO.
| trackName: "new-track-name" | |
| trackName: "track-name" |
I think the new name But I think the field What is not unique to simulcast are things like Thus I would propose that the At a later time we should define a strategy parameter outside of the |
|
I want to surface additional points made:
To solve issue (1, 5): Underneath the
To solve issue (2, 3): We should document that Cloudflare assumes equal priority for all video tracks on the transport level. For example, if there is X video tracks and Y screen shares, these should be treated equally to start. Later, we can add additional options to prioritize certain tracks over others. We should document how often and exact behavior Remote and local track definitions are diverging with the addition of simulcast field. To solve issue (4): Consider separating push track and pull track objects. To solve issue (6): Document PLI behavior when a simulcast layer switch is requested. |
|
Updated the API definition after the conversations above. |
e73893a to
9fee248
Compare
|
Howdy and thanks for contributing to our repo. The Cloudflare team reviews new, external PRs within two (2) weeks. If it's been two weeks or longer without any movement, please tag the PR Assignees in a comment. We review internal PRs within 1 week. If it's something urgent or has been sitting without a comment, start a thread in the Developer Docs space internally. PR Change SummaryIntroduced simulcast functionality in the Cloudflare Calls SFU API documentation, providing detailed explanations and examples for users.
Added Files
How can I customize these reviews?Check out the Hyperlint AI Reviewer docs for more information on how to customize the review. If you just want to ignore it on this PR, you can add the Note specifically for link checks, we only check the first 30 links in a file and we cache the results for several hours (for instance, if you just added a page, you might experience this). Our recommendation is to add |
…nd ridUnavailableStrategy
Co-authored-by: Kevin Kipp <[email protected]>
fd65754 to
2b5ea9a
Compare
* Calls: Introduce simulcast API * Update Calls simulcast API definition after feedback on 2025-02-27 * Calls: Make UpdateTracksRequest schema to be a array of TrackObject * Calls: Replace Simulcast API fallbackStrategy with priorityOrdering and ridUnavailableStrategy * Calls: Update the Calls Simulcast API after Nils' comments * Calls: Add Simulcast documentation text * Update src/content/docs/calls/simulcast.mdx Co-authored-by: Kevin Kipp <[email protected]> --------- Co-authored-by: Kevin Kipp <[email protected]>
This is a first stab at introducing simulcast into the Cloudflare Calls SFU API.
Examples
Example 1: Using the /tracks/change endpoint to reuse a transceiver
This example shows how to reuse an existing transceiver (with mid "2") to receive a different track from a remote session.
Example 2: Using the /tracks/change endpoint with simulcast preferences
This example demonstrates how to reuse a transceiver while specifying simulcast preferences, requesting the high-quality stream ("h") and falling back to the least bandwidth option if that's not available.
Example 3: Changing multiple tracks simultaneously
This example shows how to change multiple tracks in a single request, reusing different transceivers for different remote tracks.
Example 4: Using the /tracks/new endpoint with simulcast
This example demonstrates adding a new local track with simulcast capabilities, specifying the SDP with simulcast attributes and indicating a preference for the high-quality stream.
Example 5: Using the /tracks/change endpoint with a different fallback strategy
This example shows how to request a specific quality level (in this case, the lowest quality "q") with a fallback strategy of "none", which means no fallback will be attempted if the preferred RID is not available.
Open Questions
The following case is not handled: "I REALLY want the RID I just told you, but if the RID is no longer being published, then downgrade. However I'm okay with packet loss with a higher rid I can't handle", because we are using
preferredRidNotAvailablefor both "RID stopped published" and also "you don't have enough bandwidth for this RID"