Skip to content
Snippets Groups Projects
Commit c8d5e65e authored by prlanzarin's avatar prlanzarin
Browse files

Add missing changes to SFU AudioManager

parent 05540835
No related branches found
No related tags found
No related merge requests found
......@@ -21,6 +21,7 @@ module.exports = class AudioManager extends BaseManager {
this._meetings = {};
this._trackMeetingTermination();
this.messageFactory(this._onMessage);
this._iceQueues = {};
}
_trackMeetingTermination () {
......@@ -50,15 +51,12 @@ module.exports = class AudioManager extends BaseManager {
async _onMessage(message) {
Logger.debug(this._logPrefix, 'Received message [' + message.id + '] from connection', message.connectionId);
let session;
let sessionId = message.voiceBridge;
let voiceBridge = sessionId;
let connectionId = message.connectionId;
if(this._sessions[sessionId]) {
session = this._sessions[sessionId];
}
let session = this._fetchSession(sessionId);
let iceQueue = this._fetchIceQueue(sessionId+connectionId);
switch (message.id) {
case 'start':
......@@ -76,6 +74,9 @@ module.exports = class AudioManager extends BaseManager {
const sdpAnswer = await session.start(sessionId, connectionId, sdpOffer, caleeName, userId, userName);
Logger.info(this._logPrefix, "Started presenter ", sessionId, " for connection", connectionId);
// Empty the ICE queue
this._flushIceQueue(session, iceQueue);
session.once(C.MEDIA_SERVER_OFFLINE, async (event) => {
const errorMessage = this._handleError(this._logPrefix, connectionId, caleeName, C.RECV_ROLE, errors.MEDIA_SERVER_OFFLINE);
errorMessage.id = 'webRTCAudioError';
......@@ -117,12 +118,13 @@ module.exports = class AudioManager extends BaseManager {
session.onIceCandidate(message.candidate, connectionId);
} else {
Logger.warn(this._logPrefix, "There was no audio session for onIceCandidate for", sessionId, ". There should be a queue here");
iceQueue.push(message.candidate);
}
break;
case 'close':
Logger.info(this._logPrefix, 'Connection ' + connectionId + ' closed');
this._deleteIceQueue(sessionId+connectionId);
if (typeof session !== 'undefined') {
Logger.info(this._logPrefix, "Stopping viewer " + sessionId);
session.stopListener(message.connectionId);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment