You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

StandardVideoQualitySettings.ts 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. import browser from '../../modules/browser';
  2. import { CodecMimeType } from './CodecMimeType';
  3. // Default value for assumed downlink bandwidth for the local endpoint which tells the bridge to use its own calculated
  4. // BWE value while determining the number of video streams to route to the endpoint.
  5. export const ASSUMED_BANDWIDTH_BPS = -1;
  6. // Default lastN value to be used while ramping up lastN after a cpu limitation ceases to exist (if -1 or no value is
  7. // passed in config.js for channelLastN).
  8. export const DEFAULT_LAST_N = 25;
  9. // LastN value to be signaled to the bridge when the local endpoint wants to receive all the remote video sources in
  10. // the call.
  11. export const LAST_N_UNLIMITED = -1;
  12. // Default simulcast encodings config.
  13. export const SIM_LAYERS = [
  14. {
  15. rid: '1',
  16. scaleFactor: 4.0
  17. },
  18. {
  19. rid: '2',
  20. scaleFactor: 2.0
  21. },
  22. {
  23. rid: '3',
  24. scaleFactor: 1.0
  25. }
  26. ];
  27. /**
  28. * The ssrc-group semantics for SSRCs related to the video streams.
  29. */
  30. export enum SSRC_GROUP_SEMANTICS {
  31. // The semantics for group of SSRCs belonging to the same stream, primary and RTX.
  32. FID = 'FID',
  33. // The semantics for group with primary SSRCs for each of the simulcast streams.
  34. SIM = 'SIM'
  35. }
  36. /**
  37. * Standard scalability mode settings for different video codecs and the default bitrates.
  38. */
  39. export const STANDARD_CODEC_SETTINGS = {
  40. av1: {
  41. maxBitratesVideo: {
  42. low: 100000,
  43. standard: 300000,
  44. high: 1000000,
  45. fullHd: 2000000,
  46. ultraHd: 4000000,
  47. ssHigh: 2500000,
  48. none: 0
  49. },
  50. scalabilityModeEnabled: browser.supportsScalabilityModeAPI(),
  51. useSimulcast: !browser.supportsSVC(),
  52. useKSVC: browser.supportsSVC()
  53. },
  54. h264: {
  55. maxBitratesVideo: {
  56. low: 400000,
  57. standard: 800000,
  58. high: 2000000,
  59. fullHd: 4000000,
  60. ultraHd: 8000000,
  61. ssHigh: 2500000,
  62. none: 0
  63. },
  64. scalabilityModeEnabled: browser.supportsScalabilityModeAPI()
  65. },
  66. vp8: {
  67. maxBitratesVideo: {
  68. low: 200000,
  69. standard: 500000,
  70. high: 1500000,
  71. fullHd: 3000000,
  72. ultraHd: 6000000,
  73. ssHigh: 2500000,
  74. none: 0
  75. },
  76. scalabilityModeEnabled: false
  77. },
  78. vp9: {
  79. maxBitratesVideo: {
  80. low: 100000,
  81. standard: 300000,
  82. high: 1200000,
  83. fullHd: 2500000,
  84. ultraHd: 5000000,
  85. ssHigh: 2500000,
  86. none: 0
  87. },
  88. scalabilityModeEnabled: browser.supportsScalabilityModeAPI(),
  89. useSimulcast: !browser.supportsSVC(),
  90. useKSVC: browser.supportsSVC()
  91. }
  92. };
  93. /**
  94. * Video codecs in descending order of complexity for camera and desktop video types based on the results of manual
  95. * performance tests on different platforms. When a CPU limitation is encountered, client switches the call to use the
  96. * next codec in the list.
  97. */
  98. export const VIDEO_CODECS_BY_COMPLEXITY = {
  99. 'camera': [
  100. CodecMimeType.AV1,
  101. CodecMimeType.VP9,
  102. CodecMimeType.VP8
  103. ],
  104. 'desktop': [
  105. CodecMimeType.VP9,
  106. CodecMimeType.VP8,
  107. CodecMimeType.AV1
  108. ]
  109. };
  110. /**
  111. * Standard video resolutions and the corresponding quality level that will be picked for the given resolution.
  112. * For quality levels:
  113. * 'high' and above - the encoder will be configured to encode 3 spatial layers.
  114. * 'standard' - the encoder will be configured to encode 2 spatial laters.
  115. * 'low' - the encoder will be configured to encode only 1 spatial layer.
  116. * In all the above cases, each of the layers will again have 3 temporal layers, except for VP8 codec for which only
  117. * 2 temporal layers are configured by default.
  118. */
  119. export const VIDEO_QUALITY_LEVELS = [
  120. {
  121. height: 2160,
  122. level: 'ultraHd'
  123. },
  124. {
  125. height: 1080,
  126. level: 'fullHd'
  127. },
  128. {
  129. height: 720,
  130. level: 'high'
  131. },
  132. {
  133. height: 540,
  134. level: 'standard'
  135. },
  136. {
  137. height: 480,
  138. level: 'standard'
  139. },
  140. {
  141. height: 360,
  142. level: 'standard'
  143. },
  144. {
  145. height: 270,
  146. level: 'low'
  147. },
  148. {
  149. height: 180,
  150. level: 'low'
  151. },
  152. {
  153. height: 90,
  154. level: 'low'
  155. },
  156. {
  157. height: 0,
  158. level: 'none'
  159. }
  160. ];
  161. /**
  162. * Enumerate the supported video resolutions.
  163. */
  164. export enum VIDEO_QUALITY_SETTINGS {
  165. // 1920x1080 or full High Definition.
  166. FULL = 'fullHd',
  167. // 1280x720 or High Definition.
  168. HIGH = 'high',
  169. // 320x180 or Low Definition.
  170. LOW = 'low',
  171. // When the camera is turned off.
  172. NONE = 'none',
  173. // 640x360 or Standard Definition.
  174. STANDARD = 'standard',
  175. // 3840x2160 or 4k.
  176. ULTRA = 'ultraHd'
  177. }