Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref(CustomSignaling): Remove ssrcOwners&chatRoom. #2368

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -107,19 +46,4 @@ export default class CustomSignalingLayer extends SignalingLayer {
setTrackVideoType(sourceName, videoType) { // eslint-disable-line no-unused-vars
return false;
}

/**
* @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