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.7KB

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