Skip to content

Commit

Permalink
pick maxFramerate, maxBitrate and priority parameters from the Change…
Browse files Browse the repository at this point in the history
…PublishQuality message
  • Loading branch information
su225 committed Sep 29, 2023
1 parent 35907a1 commit 5592e05
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/client/src/rtc/Publisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,26 @@ export class Publisher {
}
if (shouldEnable) {
let layer = enabledLayers.find(vls => vls.name === enc.rid);

Check failure on line 440 in packages/client/src/rtc/Publisher.ts

View workflow job for this annotation

GitHub Actions / test-and-build

Replace `vls` with `(vls)`
if (layer !== undefined) {

Check failure on line 441 in packages/client/src/rtc/Publisher.ts

View workflow job for this annotation

GitHub Actions / test-and-build

Delete `⏎`

// It is possible that the SDK changes are deployed before SFU. Older SFUs
// send 0 and it must not be considered. The minimum valid value is 1.0
// because resolution scale up is not allowed
if (layer.scaleResolutionDownBy >= 1 && layer.scaleResolutionDownBy !== enc.scaleResolutionDownBy) {

Check failure on line 446 in packages/client/src/rtc/Publisher.ts

View workflow job for this annotation

GitHub Actions / test-and-build

Replace `layer.scaleResolutionDownBy·>=·1·&&·layer.scaleResolutionDownBy·!==·enc.scaleResolutionDownBy` with `⏎············layer.scaleResolutionDownBy·>=·1·&&⏎············layer.scaleResolutionDownBy·!==·enc.scaleResolutionDownBy⏎··········`
enc.scaleResolutionDownBy = layer.scaleResolutionDownBy;
changed = true;
}
if (layer.maxBitrate > 0 && layer.maxBitrate !== enc.maxBitrate) {
enc.maxBitrate = layer.maxBitrate;
changed = true;
}
// Wait till it is merged in protocol repo (https://github.com/GetStream/protocol/pull/254)
// if (layer.maxFramerate > 0 && layer.maxFramerate !== enc.maxFramerate) {
// enc.maxFramerate = layer.maxFramerate;
// changed = true;
// }
// TODO: Set priority from the ChangePublishQuality message
}
if (layer !== undefined && layer.scaleResolutionDownBy !== enc.scaleResolutionDownBy) {

Check failure on line 461 in packages/client/src/rtc/Publisher.ts

View workflow job for this annotation

GitHub Actions / test-and-build

Replace `layer·!==·undefined·&&·layer.scaleResolutionDownBy·!==·enc.scaleResolutionDownBy` with `⏎··········layer·!==·undefined·&&⏎··········layer.scaleResolutionDownBy·!==·enc.scaleResolutionDownBy⏎········`
// TODO: Find a default scale down value if SFU specifies some nonsense or doesn't set it
enc.scaleResolutionDownBy = Math.max(1.0, layer.scaleResolutionDownBy); // min should be 1.0

Check failure on line 463 in packages/client/src/rtc/Publisher.ts

View workflow job for this annotation

GitHub Actions / test-and-build

Replace `1.0,·layer.scaleResolutionDownBy` with `⏎············1.0,⏎············layer.scaleResolutionDownBy,⏎··········`
Expand Down

0 comments on commit 5592e05

Please sign in to comment.