Skip to content

Commit

Permalink
ref(CustomSignaling): Remove ssrcOwners&chatRoom.
Browse files Browse the repository at this point in the history
  • Loading branch information
hristoterezov committed Oct 6, 2023
1 parent 6d46c58 commit 1b60200
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 80 deletions.
80 changes: 2 additions & 78 deletions modules/proxyconnection/CustomSignalingLayer.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,9 @@
import { getLogger } from '@jitsi/logger';

import SignalingLayer from '../../service/RTC/SignalingLayer';

const logger = getLogger(__filename);

/**
* Custom semi-mock implementation for the Proxy connection service.
*/
export default class CustomSignalingLayer extends SignalingLayer {
/**
* Creates new instance.
*/
constructor() {
super();

/**
* A map that stores SSRCs of remote streams.
* @type {Map<number, string>} maps SSRC number to jid
*/
this.ssrcOwners = new Map();

/**
*
* @type {ChatRoom|null}
*/
this.chatRoom = null;
}

/**
* @inheritDoc
Expand All @@ -44,8 +22,8 @@ export default class CustomSignalingLayer extends SignalingLayer {
/**
* @inheritDoc
*/
getSSRCOwner(ssrc) {
return this.ssrcOwners.get(ssrc);
getSSRCOwner() {
return undefined;
}

/**
Expand All @@ -55,45 +33,6 @@ export default class CustomSignalingLayer extends SignalingLayer {
return undefined;
}

/**
* @inheritDoc
*/
removeSSRCOwners(ssrcList) {
if (!ssrcList?.length) {
return;
}

for (const ssrc of ssrcList) {
this.ssrcOwners.delete(ssrc);
}
}

/**
* Sets the <tt>ChatRoom</tt> instance used.
* @param {ChatRoom} room
*/
setChatRoom(room) {
this.chatRoom = room;
}

/**
* @inheritDoc
*/
setSSRCOwner(ssrc, endpointId) {
if (typeof ssrc !== 'number') {
throw new TypeError(`SSRC(${ssrc}) must be a number`);
}

// Now signaling layer instance is shared between different JingleSessionPC instances, so although very unlikely
// an SSRC conflict could potentially occur. Log a message to make debugging easier.
const existingOwner = this.ssrcOwners.get(ssrc);

if (existingOwner && existingOwner !== endpointId) {
logger.error(`SSRC owner re-assigned from ${existingOwner} to ${endpointId}`);
}
this.ssrcOwners.set(ssrc, endpointId);
}

/**
* @inheritDoc
*/
Expand All @@ -113,19 +52,4 @@ export default class CustomSignalingLayer extends SignalingLayer {
*/
setTrackSourceName(ssrc, sourceName) { // eslint-disable-line no-unused-vars
}

/**
* @inheritDoc
*/
updateSsrcOwnersOnLeave(id) {
const ssrcs = Array.from(this.ssrcOwners)
.filter(entry => entry[1] === id)
.map(entry => entry[0]);

if (!ssrcs?.length) {
return;
}

this.removeSSRCOwners(ssrcs);
}
}
2 changes: 0 additions & 2 deletions modules/proxyconnection/ProxyConnectionPC.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,6 @@ export default class ProxyConnectionPC {

const signalingLayer = new CustomSignalingLayer();

signalingLayer.setChatRoom(roomStub);

/**
* An additional initialize call is necessary to properly set instance
* variable for calling.
Expand Down

0 comments on commit 1b60200

Please sign in to comment.