Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .changes/video-degradation-default
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
patch type="fixed" "Use maintain-resolution as the default video degradation preference for local video publishing"
21 changes: 2 additions & 19 deletions lib/src/participant/local.dart
Original file line number Diff line number Diff line change
Expand Up @@ -386,10 +386,7 @@ class LocalParticipant extends Participant<LocalTrackPublication> {
}

if ([TrackSource.camera, TrackSource.screenShareVideo].contains(track.source)) {
final degradationPreference = publishOptions.degradationPreference ??
getDefaultDegradationPreference(
track,
);
final degradationPreference = publishOptions.degradationPreference ?? DegradationPreference.maintainResolution;
await track.setDegradationPreference(degradationPreference);
}

Expand Down Expand Up @@ -487,10 +484,7 @@ class LocalParticipant extends Participant<LocalTrackPublication> {
}

if ([TrackSource.camera, TrackSource.screenShareVideo].contains(track.source)) {
final degradationPreference = publishOptions.degradationPreference ??
getDefaultDegradationPreference(
track,
);
final degradationPreference = publishOptions.degradationPreference ?? DegradationPreference.maintainResolution;
await track.setDegradationPreference(degradationPreference);
}

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

DegradationPreference getDefaultDegradationPreference(LocalVideoTrack track) {
// a few of reasons we have different default paths:
// 1. without this, Chrome seems to aggressively resize the SVC video stating `quality-limitation: bandwidth` even when BW isn't an issue
// 2. since we are overriding contentHint to motion (to workaround L1T3 publishing), it overrides the default degradationPreference to `balanced`
final VideoDimensions dimensions = track.currentOptions.params.dimensions;
if (track.source == TrackSource.screenShareVideo || dimensions.height >= 1080) {
return DegradationPreference.maintainResolution;
}
return DegradationPreference.balanced;
}

/// Convenience method to unpublish all tracks.
Future<void> unpublishAllTracks({bool notify = true, bool? stopOnUnpublish}) async {
final trackSids = trackPublications.keys.toSet();
Expand Down
Loading