Skip to content

Commit

Permalink
Merge pull request #68 from mconf/master
Browse files Browse the repository at this point in the history
v2.4.21/v2.4.22
  • Loading branch information
antobinary authored Oct 27, 2020
2 parents 9a4afe6 + 0dfb680 commit 49a5152
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 35 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:12
FROM node:14

ADD . app

Expand Down
3 changes: 3 additions & 0 deletions config/custom-environment-variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ videoSubscriberSpecSlave:
screenshareSubscriberSpecSlave:
__name: SCREENSHARE_SUBSCRIBER_SLAVE
__format: json
screensharePlayStartEnabled:
__name: SCREENSHARE_PLAY_START_ENABLED
__format: json

kurentoAllowedCandidateIps:
__name: KURENTO_ALLOWED_CANDIDATE_IPS
Expand Down
1 change: 1 addition & 0 deletions config/default.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ common-message-version: 2.x
screenshareKeyframeInterval: 0
screenshareEnableFlashRTPBridge: false
screenshareSubscriberSpecSlave: false
screensharePlayStartEnabled: false
videoSubscriberSpecSlave: false

recordScreenSharing: true
Expand Down
37 changes: 30 additions & 7 deletions lib/screenshare/screenshare.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ const SUBSCRIBER_SPEC_SLAVE = config.has('videoSubscriberSpecSlave')
? config.get('videoSubscriberSpecSlave')
: false;
const KURENTO_REMB_PARAMS = config.util.cloneDeep(config.get('kurentoRembParams'));
const SCREENSHARE_PLAY_START_ENABLED = config.has(`screensharePlayStartEnabled`)
? config.get(`screensharePlayStartEnabled`)
: false;

const LOG_PREFIX = "[screenshare]";

Expand Down Expand Up @@ -158,7 +161,6 @@ module.exports = class Screenshare extends BaseProvider {
connectionId,
type: C.SCREENSHARE_APP,
id : 'iceCandidate',
cameraId: this._connectionId,
candidate : candidate
}), C.FROM_SCREENSHARE);
}
Expand All @@ -176,6 +178,7 @@ module.exports = class Screenshare extends BaseProvider {
this.startRecording();
}
this._status = C.MEDIA_STARTED;
this.sendPlayStart(C.SEND_ROLE, connectionId);
}
}
};
Expand All @@ -186,9 +189,26 @@ module.exports = class Screenshare extends BaseProvider {
// TODO properly implement a handler when we have a client-side reconnection procedure
}

sendPlayStart (role, connectionId) {
if (SCREENSHARE_PLAY_START_ENABLED) {
this.bbbGW.publish(JSON.stringify({
type: C.SCREENSHARE_APP,
id : 'playStart',
connectionId,
role,
}), C.FROM_SCREENSHARE);
}
}

_onViewerWebRTCMediaFlowing (connectionId) {
Logger.info(LOG_PREFIX, `Viewer WebRTC session is FLOWING`,
this._getFullViewerLogMetadata(connectionId));
const viewerUser = this._viewerUsers[connectionId];

if (viewerUser && !viewerUser.started) {
this.sendPlayStart(C.RECV_ROLE, connectionId);
viewerUser.started = true;
}
}

_onViewerWebRTCMediaNotFlowing (connectionId) {
Expand Down Expand Up @@ -614,7 +634,11 @@ module.exports = class Screenshare extends BaseProvider {
this._voiceBridge,
'SFU',
{ externalUserId: userId, name: bbbUserName, autoLeave: true });
this._viewerUsers[connectionId] = { userId, connectionId };
this._viewerUsers[connectionId] = {
userId,
connectionId,
started: false,
};

// Get the REMB spec to be used. Screenshare uses the default mixed in with
// the default spec bitrate. Fetching bitrate by the VP8 codec is just an
Expand Down Expand Up @@ -657,11 +681,10 @@ module.exports = class Screenshare extends BaseProvider {
this._getFullViewerLogMetadata(connectionId));

return resolve(sdpAnswer);
}
catch (err) {
Logger.error(LOG_PREFIX, `Viewer subscribe failed for ${userId} due to ${err.message}`,
{ ...this._getFullViewerLogMetadata(id), error: this._handleError(LOG_PREFIX, err) });
return reject(this._handleError(LOG_PREFIX, err));
} catch (error) {
Logger.error(LOG_PREFIX, `Viewer subscribe failed for ${userId} due to ${error.message}`,
{ ...this._getFullViewerLogMetadata(connectionId), error: this._handleError(LOG_PREFIX, error) });
return reject(this._handleError(LOG_PREFIX, error));
}
});
}
Expand Down
8 changes: 8 additions & 0 deletions lib/video/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,14 @@ module.exports = class Video extends BaseProvider {
this.id
);

this.bbbGW.publish(JSON.stringify({
connectionId: this.connectionId,
type: 'video',
role: this.role,
id : 'playStop',
cameraId: this.id,
}), C.FROM_VIDEO);

this.bbbGW.publish(userCamEvent, C.TO_AKKA_APPS_CHAN_2x);
}

Expand Down
31 changes: 7 additions & 24 deletions package-lock.json

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

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bbb-webrtc-sfu",
"version": "2.4.20",
"version": "2.4.22",
"private": true,
"scripts": {
"start": "node server.js",
Expand All @@ -18,8 +18,8 @@
"redis": "2.8.0",
"sdp-transform": "2.13.0",
"sip.js": "git+https://github.com/mconf/sip.js.git#v0.7.5.10",
"winston": "2.4.2",
"ws": "3.3.3"
"winston": "2.4.5",
"ws": "7.3.1"
},
"optionalDependencies": {}
}

0 comments on commit 49a5152

Please sign in to comment.