getDefaultDegradationPreference function

DegradationPreference getDefaultDegradationPreference(
  1. TrackSource source
)

Returns the degradation preference to use for a video track published under source, when the application did not set one explicitly.

Any other source means the application declined to declare a motion-vs-detail intent, so this falls back to balanced, the preference the WebRTC spec mandates as the default.

Implementation

DegradationPreference getDefaultDegradationPreference(TrackSource source) {
  switch (source) {
    case TrackSource.camera:
      return DegradationPreference.maintainFramerate;
    case TrackSource.screenShareVideo:
      return DegradationPreference.maintainResolution;
    default:
      return DegradationPreference.balanced;
  }
}