modified lib-jitsi-meet dev repo
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.

CustomSignalingLayer.js 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. import { getLogger } from '@jitsi/logger';
  2. import SignalingLayer from '../../service/RTC/SignalingLayer';
  3. const logger = getLogger(__filename);
  4. /**
  5. * Custom semi-mock implementation for the Proxy connection service.
  6. */
  7. export default class CustomSignalingLayer extends SignalingLayer {
  8. /**
  9. * Creates new instance.
  10. */
  11. constructor() {
  12. super();
  13. /**
  14. * A map that stores SSRCs of remote streams.
  15. * @type {Map<number, string>} maps SSRC number to jid
  16. */
  17. this.ssrcOwners = new Map();
  18. /**
  19. *
  20. * @type {ChatRoom|null}
  21. */
  22. this.chatRoom = null;
  23. }
  24. /**
  25. * Sets the <tt>ChatRoom</tt> instance used.
  26. * @param {ChatRoom} room
  27. */
  28. setChatRoom(room) {
  29. this.chatRoom = room;
  30. }
  31. /**
  32. * @inheritDoc
  33. */
  34. getPeerMediaInfo(owner, mediaType, sourceName) { // eslint-disable-line no-unused-vars
  35. return {};
  36. }
  37. /**
  38. * @inheritDoc
  39. */
  40. getPeerSourceInfo(owner, sourceName) { // eslint-disable-line no-unused-vars
  41. return undefined;
  42. }
  43. /**
  44. * @inheritDoc
  45. */
  46. getSSRCOwner(ssrc) {
  47. return this.ssrcOwners.get(ssrc);
  48. }
  49. /**
  50. * @inheritDoc
  51. */
  52. setSSRCOwner(ssrc, endpointId) {
  53. if (typeof ssrc !== 'number') {
  54. throw new TypeError(`SSRC(${ssrc}) must be a number`);
  55. }
  56. // Now signaling layer instance is shared between different JingleSessionPC instances, so although very unlikely
  57. // an SSRC conflict could potentially occur. Log a message to make debugging easier.
  58. const existingOwner = this.ssrcOwners.get(ssrc);
  59. if (existingOwner && existingOwner !== endpointId) {
  60. logger.error(`SSRC owner re-assigned from ${existingOwner} to ${endpointId}`);
  61. }
  62. this.ssrcOwners.set(ssrc, endpointId);
  63. }
  64. /**
  65. * @inheritDoc
  66. */
  67. setTrackMuteStatus(sourceName, muted) { // eslint-disable-line no-unused-vars
  68. return false;
  69. }
  70. /**
  71. * @inheritDoc
  72. */
  73. setTrackVideoType(sourceName, videoType) { // eslint-disable-line no-unused-vars
  74. return false;
  75. }
  76. /**
  77. * @inheritDoc
  78. */
  79. getTrackSourceName(ssrc) { // eslint-disable-line no-unused-vars
  80. return undefined;
  81. }
  82. /**
  83. * @inheritDoc
  84. */
  85. setTrackSourceName(ssrc, sourceName) { // eslint-disable-line no-unused-vars
  86. }
  87. }