Skip to content

Commit b6cc65d

Browse files
authored
Use maintain-resolution as the default video degradation preference (#1106)
## Summary - Align Flutter default local-video degradation behavior with the Swift SDK. - Default unset `VideoPublishOptions.degradationPreference` to `maintainResolution` for camera and screen-share publishing. - Keep explicit degradation preferences overrideable by apps. ## Context Related to #1097, which explores preserving video quality through a live-streaming option. This PR takes the smaller SDK-default approach instead: use maintain-resolution by default, matching Swift, without adding a separate app-facing toggle for this behavior. ## Testing - `dart analyze` - `flutter test test/core/room_e2e_test.dart`
1 parent 707792b commit b6cc65d

2 files changed

Lines changed: 3 additions & 19 deletions

File tree

.changes/video-degradation-default

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
patch type="fixed" "Use maintain-resolution as the default video degradation preference for local video publishing"

lib/src/participant/local.dart

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -386,10 +386,7 @@ class LocalParticipant extends Participant<LocalTrackPublication> {
386386
}
387387

388388
if ([TrackSource.camera, TrackSource.screenShareVideo].contains(track.source)) {
389-
final degradationPreference = publishOptions.degradationPreference ??
390-
getDefaultDegradationPreference(
391-
track,
392-
);
389+
final degradationPreference = publishOptions.degradationPreference ?? DegradationPreference.maintainResolution;
393390
await track.setDegradationPreference(degradationPreference);
394391
}
395392

@@ -487,10 +484,7 @@ class LocalParticipant extends Participant<LocalTrackPublication> {
487484
}
488485

489486
if ([TrackSource.camera, TrackSource.screenShareVideo].contains(track.source)) {
490-
final degradationPreference = publishOptions.degradationPreference ??
491-
getDefaultDegradationPreference(
492-
track,
493-
);
487+
final degradationPreference = publishOptions.degradationPreference ?? DegradationPreference.maintainResolution;
494488
await track.setDegradationPreference(degradationPreference);
495489
}
496490

@@ -593,17 +587,6 @@ class LocalParticipant extends Participant<LocalTrackPublication> {
593587
await pub.dispose();
594588
}
595589

596-
DegradationPreference getDefaultDegradationPreference(LocalVideoTrack track) {
597-
// a few of reasons we have different default paths:
598-
// 1. without this, Chrome seems to aggressively resize the SVC video stating `quality-limitation: bandwidth` even when BW isn't an issue
599-
// 2. since we are overriding contentHint to motion (to workaround L1T3 publishing), it overrides the default degradationPreference to `balanced`
600-
final VideoDimensions dimensions = track.currentOptions.params.dimensions;
601-
if (track.source == TrackSource.screenShareVideo || dimensions.height >= 1080) {
602-
return DegradationPreference.maintainResolution;
603-
}
604-
return DegradationPreference.balanced;
605-
}
606-
607590
/// Convenience method to unpublish all tracks.
608591
Future<void> unpublishAllTracks({bool notify = true, bool? stopOnUnpublish}) async {
609592
final trackSids = trackPublications.keys.toSet();

0 commit comments

Comments
 (0)