Dynacast: keep SVC tracks active while any quality is subscribed#1214
Open
MaxHeimbrock wants to merge 1 commit into
Open
Dynacast: keep SVC tracks active while any quality is subscribed#1214MaxHeimbrock wants to merge 1 commit into
MaxHeimbrock wants to merge 1 commit into
Conversation
b3509d2 to
00d2c3d
Compare
Port the SVC special case from client-sdk-js: for SVC codecs (VP9/AV1) all spatial layers ride in a single encoded stream and the SFU selects layers server-side, so any enabled quality in a SubscribedQualityUpdate must keep the whole encoding active instead of being matched per-layer. Adds an e2e test publishing VP9 L3T3_KEY that verifies the encoding stays active across quality requests, deactivates when the last subscriber leaves, and reactivates on resubscribe. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
00d2c3d to
114340b
Compare
ladvoc
approved these changes
Jul 2, 2026
Comment on lines
+446
to
+449
| let sub_options = TestRoomOptions::default(); | ||
|
|
||
| let mut rooms = test_rooms_with_options([pub_options, sub_options]).await?; | ||
| let (pub_room, _pub_events) = rooms.remove(0); |
Contributor
There was a problem hiding this comment.
nitpick: You can use rooms.pop() here.
|
|
||
| let video_codec = publication.publish_options().video_codec; | ||
| // SVC codecs carry all spatial layers in one encoded stream. | ||
| let is_svc = matches!( |
Contributor
There was a problem hiding this comment.
suggestion(non-blocking): Consider breaking this out into a const helper function.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #1213 (targets that branch; rebase to
mainonce it merges).What
Ports the SVC special case from client-sdk-js that #1003 didn't bring over: for SVC codecs (VP9/AV1) all spatial layers ride in a single encoded stream and the SFU selects layers server-side. When a
SubscribedQualityUpdatehas any quality enabled, the whole encoding must stay active, instead of matching qualities per encoding (which can deactivate the track, e.g. if the SFU enables only a quality that doesn't map to the rid-less encoding).JS reference:
setPublishingLayersForSenderinlivekit-client—if (isSVC) { if (qualities.some(q => q.enabled)) qualities.forEach(q => q.enabled = true); }, withisSVCCodec = vp9 || av1.Changes
LocalVideoTrack::set_publishing_layerstakesis_svcand applies the any-enabled rule.handle_subscribed_quality_updatederivesis_svcfrom the publication's codec (VP9/AV1), mirroringisSVCCodecin JS.test_dynacast_svc(VP9,L3T3_KEY): the single SVC encoding stays active across LOW/HIGH quality requests, deactivates when the last subscriber unsubscribes, and reactivates on resubscribe.SolidColorTrack::publish_with_optionstest helper for publishing with customTrackPublishOptions.Testing
All dynacast e2e tests pass against a local
livekit-server --dev:Observed SFU updates in the new test confirm the flow:
vp9:[Low=true, Medium=false, High=false]on a LOW request keeps the encoding ON;[Low=false, Medium=false, High=false]after unsubscribe turns it off.🤖 Generated with Claude Code