Skip to content

Commit

Permalink
Merge pull request #122 from mconf/v2.4.4-dev
Browse files Browse the repository at this point in the history
 Addresses #109 and closes 2.4.4
  • Loading branch information
prlanzarin authored Sep 26, 2019
2 parents 3ed6d2c + f8b2934 commit b9ef3d3
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 2 deletions.
4 changes: 4 additions & 0 deletions config/custom-environment-variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,7 @@ conference-media-specs:

videoSubscriberSpecSlave: VIDEO_SUBSCRIBER_SLAVE
screenshareSubscriberSpecSlave: SCREENSHARE_SUBSCRIBER_SLAVE

kurentoAllowedCandidateIps:
__name: KURENTO_ALLOWED_CANDIDATE_IPS
__format: json
5 changes: 5 additions & 0 deletions config/default.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,8 @@ kurentoRembParams:
upLosses: 12
decrementFactor: 0.5
thresholdFactor: 0.8
# Optional configuration. List of VALID IPs to be used to define valid outbound ICE candidates.
# This is a short-term optimization to reduce the number of candidate sent to
# the client by filtering out anything that isn't in this list
kurentoAllowedCandidateIps:
#- <ipv4|ipv6>
14 changes: 14 additions & 0 deletions lib/mcs-core/lib/adapters/kurento/kurento.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ const GLOBAL_EVENT_EMITTER = require('../../utils/emitter');
const SDPMedia = require('../../model/sdp-media');
const RecordingMedia = require('../../model/recording-media');
const KURENTO_REMB_PARAMS = config.get('kurentoRembParams');
const ALLOWED_CANDIDATE_IPS = config.has('kurentoAllowedCandidateIps')
? config.get('kurentoAllowedCandidateIps')
: [];

const LOG_PREFIX = "[mcs-kurento-adapter]";

Expand Down Expand Up @@ -936,6 +939,14 @@ module.exports = class Kurento extends EventEmitter {
return;
}

_shouldSendCandidate (candidate) {
if (ALLOWED_CANDIDATE_IPS == null || ALLOWED_CANDIDATE_IPS.length <= 0) {
return true;
}

return ALLOWED_CANDIDATE_IPS.some(ip => candidate.includes(ip));
}

addMediaEventListener (eventTag, elementId) {
const mediaElement = this._mediaElements[elementId];
let event = {};
Expand All @@ -945,6 +956,9 @@ module.exports = class Kurento extends EventEmitter {
mediaElement.on(eventTag, (e) => {
switch (eventTag) {
case C.EVENT.MEDIA_STATE.ICE:
if (!this._shouldSendCandidate(e.candidate.candidate)) {
return;
}
event.candidate = KMS_CLIENT.getComplexType('IceCandidate')(e.candidate);
event.elementId = elementId;
this.emit(C.EVENT.MEDIA_STATE.ICE+elementId, event);
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bbb-webrtc-sfu",
"version": "2.4.3",
"version": "2.4.4",
"private": true,
"scripts": {
"start": "node server.js",
Expand Down

0 comments on commit b9ef3d3

Please sign in to comment.