Skip to content

Commit

Permalink
[mirotalksfu] - update dep
Browse files Browse the repository at this point in the history
  • Loading branch information
miroslavpejic85 committed May 9, 2024
1 parent a0d4c24 commit f6b7cf5
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 39 deletions.
31 changes: 22 additions & 9 deletions app/src/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ dependencies: {
* @license For commercial or closed source, contact us at [email protected] or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - [email protected]
* @version 1.4.32
* @version 1.4.33
*
*/

Expand Down Expand Up @@ -444,7 +444,7 @@ function startServer() {
log.debug('Direct Join', {
OIDCUserAuthenticated: OIDCUserAuthenticated,
authenticated: hostCfg.authenticated,
host_protected: hostCfg.protected,
hostProtected: hostCfg.protected,
});

let peerUsername,
Expand Down Expand Up @@ -501,13 +501,26 @@ function startServer() {

const OIDCUserAuthenticated = OIDC.enabled && req.oidc.isAuthenticated();

if (OIDCUserAuthenticated || hostCfg.authenticated || authHost.isRoomActive()) {
log.debug('/join/room', {
OIDCUserAuthenticated: OIDCUserAuthenticated,
authenticated: hostCfg.authenticated,
host_protected: hostCfg.protected,
activeRoom: authHost.isRoomActive(),
});
const roomId = req.params.roomId;

const roomActive = authHost.isRoomActive();

const roomExist = roomList.has(roomId);

const roomCount = roomList.size;

log.debug('/join/:roomId', {
OIDCUserAuthenticated: OIDCUserAuthenticated,
hostProtected: hostCfg.protected,
hostAuthenticated: hostCfg.authenticated,
roomActive: roomActive,
roomExist: roomExist,
roomCount: roomCount,
roomId: roomId,
});

if (OIDCUserAuthenticated || hostCfg.authenticated || roomActive) {
//...

if (hostCfg.protected) authHost.setRoomActive();

Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mirotalksfu",
"version": "1.4.32",
"version": "1.4.33",
"description": "WebRTC SFU browser-based video calls",
"main": "Server.js",
"scripts": {
Expand Down Expand Up @@ -41,8 +41,8 @@
"node": ">=18"
},
"dependencies": {
"@sentry/integrations": "7.113.0",
"@sentry/node": "7.113.0",
"@sentry/integrations": "7.114.0",
"@sentry/node": "7.114.0",
"axios": "^1.6.8",
"body-parser": "1.20.2",
"colors": "1.4.0",
Expand All @@ -53,11 +53,11 @@
"express-openid-connect": "^2.17.1",
"httpolyglot": "0.1.2",
"jsonwebtoken": "^9.0.2",
"mediasoup": "3.14.5",
"mediasoup-client": "3.7.7",
"mediasoup": "3.14.6",
"mediasoup-client": "3.7.8",
"ngrok": "^5.0.0-beta.2",
"nodemailer": "^6.9.13",
"openai": "^4.41.1",
"openai": "^4.43.0",
"qs": "6.12.1",
"socket.io": "4.7.5",
"swagger-ui-express": "5.0.0",
Expand Down
2 changes: 1 addition & 1 deletion public/js/Room.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if (location.href.substr(0, 5) !== 'https') location.href = 'https' + location.h
* @license For commercial or closed source, contact us at [email protected] or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - [email protected]
* @version 1.4.32
* @version 1.4.33
*
*/

Expand Down
2 changes: 1 addition & 1 deletion public/js/RoomClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @license For commercial or closed source, contact us at [email protected] or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - [email protected]
* @version 1.4.32
* @version 1.4.33
*
*/

Expand Down
66 changes: 44 additions & 22 deletions public/sfu/MediasoupClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -2248,24 +2248,27 @@
*/
async load({ routerRtpCapabilities }) {
logger.debug('load() [routerRtpCapabilities:%o]', routerRtpCapabilities);
routerRtpCapabilities = utils.clone(routerRtpCapabilities);
// Temporal handler to get its capabilities.
let handler;
try {
if (this._loaded) {
throw new errors_1.InvalidStateError('already loaded');
}
// Clone given router RTP capabilities to not modify input data.
const clonedRouterRtpCapabilities = utils.clone(routerRtpCapabilities);
// This may throw.
ortc.validateRtpCapabilities(routerRtpCapabilities);
ortc.validateRtpCapabilities(clonedRouterRtpCapabilities);
handler = this._handlerFactory();
const nativeRtpCapabilities = await handler.getNativeRtpCapabilities();
logger.debug('load() | got native RTP capabilities:%o', nativeRtpCapabilities);
// Clone obtained native RTP capabilities to not modify input data.
const clonedNativeRtpCapabilities = utils.clone(nativeRtpCapabilities);
// This may throw.
ortc.validateRtpCapabilities(nativeRtpCapabilities);
ortc.validateRtpCapabilities(clonedNativeRtpCapabilities);
// Get extended RTP capabilities.
this._extendedRtpCapabilities = ortc.getExtendedRtpCapabilities(
nativeRtpCapabilities,
routerRtpCapabilities,
clonedNativeRtpCapabilities,
clonedRouterRtpCapabilities,
);
logger.debug('load() | got extended RTP capabilities:%o', this._extendedRtpCapabilities);
// Check whether we can produce audio/video.
Expand Down Expand Up @@ -3012,12 +3015,12 @@
this._canProduceByKind = canProduceByKind;
this._maxSctpMessageSize = sctpParameters ? sctpParameters.maxMessageSize : null;
// Clone and sanitize additionalSettings.
additionalSettings = utils.clone(additionalSettings) || {};
delete additionalSettings.iceServers;
delete additionalSettings.iceTransportPolicy;
delete additionalSettings.bundlePolicy;
delete additionalSettings.rtcpMuxPolicy;
delete additionalSettings.sdpSemantics;
const clonedAdditionalSettings = utils.clone(additionalSettings) || {};
delete clonedAdditionalSettings.iceServers;
delete clonedAdditionalSettings.iceTransportPolicy;
delete clonedAdditionalSettings.bundlePolicy;
delete clonedAdditionalSettings.rtcpMuxPolicy;
delete clonedAdditionalSettings.sdpSemantics;
this._handler = handlerFactory();
this._handler.run({
direction,
Expand All @@ -3027,7 +3030,7 @@
sctpParameters,
iceServers,
iceTransportPolicy,
additionalSettings,
additionalSettings: clonedAdditionalSettings,
proprietaryConstraints,
extendedRtpCapabilities,
});
Expand Down Expand Up @@ -3300,7 +3303,6 @@
*/
async consume({ id, producerId, kind, rtpParameters, streamId, appData = {} }) {
logger.debug('consume()');
rtpParameters = utils.clone(rtpParameters);
if (this._closed) {
throw new errors_1.InvalidStateError('closed');
} else if (this._direction !== 'recv') {
Expand All @@ -3316,16 +3318,18 @@
} else if (appData && typeof appData !== 'object') {
throw new TypeError('if given, appData must be an object');
}
// Clone given RTP parameters to not modify input data.
const clonedRtpParameters = utils.clone(rtpParameters);
// Ensure the device can consume it.
const canConsume = ortc.canReceive(rtpParameters, this._extendedRtpCapabilities);
const canConsume = ortc.canReceive(clonedRtpParameters, this._extendedRtpCapabilities);
if (!canConsume) {
throw new errors_1.UnsupportedError('cannot consume this Producer');
}
const consumerCreationTask = new ConsumerCreationTask({
id,
producerId,
kind,
rtpParameters,
rtpParameters: clonedRtpParameters,
streamId,
appData,
});
Expand Down Expand Up @@ -3419,7 +3423,6 @@
appData = {},
}) {
logger.debug('consumeData()');
sctpStreamParameters = utils.clone(sctpStreamParameters);
if (this._closed) {
throw new errors_1.InvalidStateError('closed');
} else if (this._direction !== 'recv') {
Expand All @@ -3435,20 +3438,22 @@
} else if (appData && typeof appData !== 'object') {
throw new TypeError('if given, appData must be an object');
}
// Clone given SCTP stream parameters to not modify input data.
const clonedSctpStreamParameters = utils.clone(sctpStreamParameters);
// This may throw.
ortc.validateSctpStreamParameters(sctpStreamParameters);
ortc.validateSctpStreamParameters(clonedSctpStreamParameters);
// Enqueue command.
return this._awaitQueue.push(async () => {
const { dataChannel } = await this._handler.receiveDataChannel({
sctpStreamParameters,
sctpStreamParameters: clonedSctpStreamParameters,
label,
protocol,
});
const dataConsumer = new DataConsumer_1.DataConsumer({
id,
dataProducerId,
dataChannel,
sctpStreamParameters,
sctpStreamParameters: clonedSctpStreamParameters,
appData,
});
this._dataConsumers.set(dataConsumer.id, dataConsumer);
Expand Down Expand Up @@ -13857,7 +13862,7 @@
/**
* Expose mediasoup-client version.
*/
exports.version = '3.7.6';
exports.version = '3.7.8';
/**
* Expose parseScalabilityMode() function.
*/
Expand Down Expand Up @@ -14377,7 +14382,7 @@
// Otherwise look for a compatible set of codecs.
else {
for (let idx = 0; idx < codecs.length; ++idx) {
if (matchCodecs(codecs[idx], capCodec)) {
if (matchCodecs(codecs[idx], capCodec, { strict: true })) {
filteredCodecs.push(codecs[idx]);
if (isRtxCodec(codecs[idx + 1])) {
filteredCodecs.push(codecs[idx + 1]);
Expand Down Expand Up @@ -14897,7 +14902,7 @@
function (require, module, exports) {
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
exports.generateRandomNumber = exports.clone = void 0;
exports.deepFreeze = exports.generateRandomNumber = exports.clone = void 0;
/**
* Clones the given value.
*/
Expand All @@ -14921,6 +14926,23 @@
return Math.round(Math.random() * 10000000);
}
exports.generateRandomNumber = generateRandomNumber;
/**
* Make an object or array recursively immutable.
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze.
*/
function deepFreeze(object) {
// Retrieve the property names defined on object.
const propNames = Reflect.ownKeys(object);
// Freeze properties before freezing self.
for (const name of propNames) {
const value = object[name];
if ((value && typeof value === 'object') || typeof value === 'function') {
deepFreeze(value);
}
}
return Object.freeze(object);
}
exports.deepFreeze = deepFreeze;
},
{},
],
Expand Down

0 comments on commit f6b7cf5

Please sign in to comment.