modified lib-jitsi-meet dev repo
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

FeatureFlags.js 2.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import { getLogger } from '@jitsi/logger';
  2. import browser from '../browser';
  3. const logger = getLogger('FeatureFlags');
  4. /**
  5. * A global module for accessing information about different feature flags state.
  6. */
  7. class FeatureFlags {
  8. /**
  9. * Configures the module.
  10. *
  11. * @param {object} flags - The feature flags.
  12. * @param {boolean=} flags.enableUnifiedOnChrome - Enable unified plan implementation support on Chromium.
  13. * @param {boolean=} flags.runInLiteMode - Enables lite mode for testing to disable media decoding.
  14. * @param {boolean=} flags.sourceNameSignaling - Enables source names in the signaling.
  15. * @param {boolean=} flags.receiveMultipleVideoStreams - Signal support for receiving multiple video streams.
  16. */
  17. init(flags) {
  18. this._receiveMultipleVideoStreams = flags.receiveMultipleVideoStreams ?? true;
  19. this._runInLiteMode = Boolean(flags.runInLiteMode);
  20. this._sendMultipleVideoStreams = flags.sendMultipleVideoStreams ?? true;
  21. this._sourceNameSignaling = flags.sourceNameSignaling ?? true;
  22. this._ssrcRewriting = Boolean(flags.ssrcRewritingEnabled);
  23. // For Chromium, check if Unified plan is enabled.
  24. this._usesUnifiedPlan = browser.supportsUnifiedPlan()
  25. && (!browser.isChromiumBased() || (flags.enableUnifiedOnChrome ?? true));
  26. logger.info(`Source name signaling: ${this._sourceNameSignaling},`
  27. + ` Send multiple video streams: ${this._sendMultipleVideoStreams},`
  28. + ` uses Unified plan: ${this._usesUnifiedPlan}`);
  29. }
  30. /**
  31. * Checks if multiple local video streams support is enabled.
  32. *
  33. * @returns {boolean}
  34. */
  35. isMultiStreamSupportEnabled() {
  36. return this._sourceNameSignaling && this._sendMultipleVideoStreams && this._usesUnifiedPlan;
  37. }
  38. /**
  39. * Checks if receiving multiple video streams is supported.
  40. *
  41. * @returns {boolean}
  42. */
  43. isReceiveMultipleVideoStreamsSupported() {
  44. return this._receiveMultipleVideoStreams;
  45. }
  46. /**
  47. * Checks if the run in lite mode is enabled.
  48. * This will cause any media to be received and not decoded. (Directions are inactive and no ssrc and ssrc-groups
  49. * are added to the remote description). This can be used for various test scenarios.
  50. *
  51. * @returns {boolean}
  52. */
  53. isRunInLiteModeEnabled() {
  54. return this._runInLiteMode;
  55. }
  56. /**
  57. * Checks if the source name signaling is enabled.
  58. *
  59. * @returns {boolean}
  60. */
  61. isSourceNameSignalingEnabled() {
  62. return this._sourceNameSignaling;
  63. }
  64. /**
  65. * Checks if the clients supports re-writing of the SSRCs on the media streams by the bridge.
  66. * @returns {boolean}
  67. */
  68. isSsrcRewritingSupported() {
  69. return this._ssrcRewriting;
  70. }
  71. }
  72. export default new FeatureFlags();