Skip to content

Commit

Permalink
Merge pull request #73 from mconf/master
Browse files Browse the repository at this point in the history
v2.4.24
  • Loading branch information
prlanzarin authored Dec 14, 2020
2 parents 52fa574 + 69be47f commit 9aa9f02
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 47 deletions.
16 changes: 12 additions & 4 deletions lib/audio/AudioManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,22 @@ module.exports = class AudioManager extends BaseManager {

switch (message.id) {
case 'start':
const handleStartError = (errorMessage) => {
const handleSessionWideStartError = (errorMessage) => {
errorMessage.id = 'webRTCAudioError';
this._stopSession(sessionId);
this._bbbGW.publish(JSON.stringify({
...errorMessage,
}), C.FROM_AUDIO);
}

const handleListenerStartError = (errorMessage) => {
errorMessage.id = 'webRTCAudioError';
if (session) session.stopListener(connectionId);
this._bbbGW.publish(JSON.stringify({
...errorMessage,
}), C.FROM_AUDIO);
}

Logger.debug(this._logPrefix, 'Received start message', message, 'from connection', connectionId);

if (session == null) {
Expand All @@ -111,7 +119,7 @@ module.exports = class AudioManager extends BaseManager {
await session.upstartSourceAudio(message.sdpOffer, message.caleeName);
} catch (error) {
const errorMessage = this._handleError(this._logPrefix, connectionId, message.calleeName, C.RECV_ROLE, error);
return handleStartError(errorMessage);
return handleSessionWideStartError(errorMessage);
}
}

Expand All @@ -121,7 +129,7 @@ module.exports = class AudioManager extends BaseManager {
session.start(sessionId, connectionId, message.sdpOffer, message.caleeName, message.userId, message.userName, (error, sdpAnswer) => {
if (error) {
const errorMessage = this._handleError(this._logPrefix, connectionId, null, C.RECV_ROLE, error);
return handleStartError(errorMessage);
return handleListenerStartError(errorMessage);
}

Logger.info(this._logPrefix, `Started listen only session for user ${message.userId} at ${sessionId} with connectionId ${connectionId}`);
Expand All @@ -130,7 +138,7 @@ module.exports = class AudioManager extends BaseManager {

session.once(C.MEDIA_SERVER_OFFLINE, async (event) => {
const errorMessage = this._handleError(this._logPrefix, connectionId, message.caleeName, C.RECV_ROLE, errors.MEDIA_SERVER_OFFLINE);
return handleStartError(errorMessage);
return handleSessionWideStartError(errorMessage);
});

this._bbbGW.publish(JSON.stringify({
Expand Down
7 changes: 5 additions & 2 deletions lib/audio/audio.js
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ module.exports = class Audio extends BaseProvider {
async _checkForStopGlare (connectionId) {
const user = this.getUser(connectionId);
if (!Audio.isValidUser(user)) {
Logger.warn(LOG_PREFIX, `Session was stopped while starting, clean things up`,
Logger.warn(LOG_PREFIX, `GLARE: session was stopped while starting, clean things up`,
this._getFullLogMetadata(connectionId));

try {
Expand Down Expand Up @@ -617,7 +617,9 @@ module.exports = class Audio extends BaseProvider {
}
}

if (this.audioEndpoints && Object.keys(this.audioEndpoints).length === 1) {
if (this.audioEndpoints
&& Object.keys(this.audioEndpoints).length === 1
&& this.audioEndpoints[connectionId]) {
this._stopSourceAudio();
}

Expand Down Expand Up @@ -664,6 +666,7 @@ module.exports = class Audio extends BaseProvider {
this.sourceAudioStarted = false;
this.sourceAudioStatus = C.MEDIA_STOPPED;
this.emit(C.MEDIA_STOPPED, this.voiceBridge);
Logger.info(LOG_PREFIX, 'Stopping source audio', this._getPartialLogMetadata());
}

sendUserDisconnectedFromGlobalAudioMessage(connectionId) {
Expand Down
65 changes: 26 additions & 39 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bbb-webrtc-sfu",
"version": "2.4.23",
"version": "2.4.24",
"private": true,
"scripts": {
"start": "node server.js",
Expand All @@ -10,7 +10,7 @@
"config": "1.30.0",
"ipaddr.js": "1.9.1",
"js-yaml": "3.13.1",
"kurento-client": "git+https://github.com/Kurento/kurento-client-js.git#6.14.0",
"kurento-client": "git+https://github.com/Kurento/kurento-client-js.git#6.15.0",
"mcs-js": "git+https://github.com/mconftec/mcs-js.git#v0.0.9",
"modesl": "1.2.1",
"pegjs": "0.8.0",
Expand Down

0 comments on commit 9aa9f02

Please sign in to comment.