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.

FeatureFlags.js 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 {boolean} flags.runInLiteMode - Enables lite mode for testing to disable media decoding.
  12. * @param {boolean} flags.sourceNameSignaling - Enables source names in the signaling.
  13. */
  14. init(flags) {
  15. this._runInLiteMode = Boolean(flags.runInLiteMode);
  16. this._sourceNameSignaling = Boolean(flags.sourceNameSignaling);
  17. this._sendMultipleVideoStreams = Boolean(flags.sendMultipleVideoStreams);
  18. this._ssrcRewriting = Boolean(flags.ssrcRewritingOnBridgeSupported);
  19. // For Chromium, check if Unified plan is enabled.
  20. this._usesUnifiedPlan = browser.supportsUnifiedPlan()
  21. && (!browser.isChromiumBased() || (flags.enableUnifiedOnChrome ?? true));
  22. logger.info(`Source name signaling: ${this._sourceNameSignaling},`
  23. + ` Send multiple video streams: ${this._sendMultipleVideoStreams},`
  24. + ` SSRC rewriting supported: ${this._ssrcRewriting},`
  25. + ` uses Unified plan: ${this._usesUnifiedPlan}`);
  26. }
  27. /**
  28. * Checks if multiple local video streams support is enabled.
  29. *
  30. * @returns {boolean}
  31. */
  32. isMultiStreamSupportEnabled() {
  33. return this._sourceNameSignaling && this._sendMultipleVideoStreams && this._usesUnifiedPlan;
  34. }
  35. /**
  36. * Checks if the run in lite mode is enabled.
  37. * This will cause any media to be received and not decoded. (Directions are inactive and no ssrc and ssrc-groups
  38. * are added to the remote description). This can be used for various test scenarios.
  39. *
  40. * @returns {boolean}
  41. */
  42. isRunInLiteModeEnabled() {
  43. return this._runInLiteMode;
  44. }
  45. /**
  46. * Checks if the source name signaling is enabled.
  47. *
  48. * @returns {boolean}
  49. */
  50. isSourceNameSignalingEnabled() {
  51. return this._sourceNameSignaling;
  52. }
  53. /**
  54. * Checks if the clients supports re-writing of the SSRCs on the media streams by the bridge.
  55. * @returns {boolean}
  56. */
  57. isSsrcRewritingSupported() {
  58. return this._ssrcRewriting;
  59. }
  60. }
  61. export default new FeatureFlags();