From 40278fcc653632ebd264613375ca1749686e46be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Cervi=C3=B1o?= Date: Thu, 27 Jul 2017 13:09:09 +0200 Subject: [PATCH] Fix issues with audio only streams. (#986) --- erizo_controller/erizoClient/src/Events.js | 3 +++ erizo_controller/erizoClient/src/Room.js | 8 +++++--- .../erizoClient/src/webrtc-stacks/BaseStack.js | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/erizo_controller/erizoClient/src/Events.js b/erizo_controller/erizoClient/src/Events.js index 34771bc6e5..2bb65180d1 100644 --- a/erizo_controller/erizoClient/src/Events.js +++ b/erizo_controller/erizoClient/src/Events.js @@ -24,6 +24,9 @@ const EventDispatcher = () => { // It removes an available event listener. that.removeEventListener = (eventType, listener) => { + if (!dispatcher.eventListeners[eventType]) { + return; + } const index = dispatcher.eventListeners[eventType].indexOf(listener); if (index !== -1) { dispatcher.eventListeners[eventType].splice(index, 1); diff --git a/erizo_controller/erizoClient/src/Room.js b/erizo_controller/erizoClient/src/Room.js index c93773f8ec..3d90b1f077 100644 --- a/erizo_controller/erizoClient/src/Room.js +++ b/erizo_controller/erizoClient/src/Room.js @@ -149,8 +149,8 @@ const Room = (altIo, altConnection, specInput) => { browser: stream.pc.browser }, undefined, () => {}); }, nop2p: true, - audio: stream.hasAudio(), - video: stream.hasVideo(), + audio: options.audio && stream.hasAudio(), + video: options.video && stream.hasVideo(), maxAudioBW: options.maxAudioBW, maxVideoBW: options.maxVideoBW, limitMaxAudioBW: spec.maxAudioBW, @@ -437,7 +437,9 @@ const Room = (altIo, altConnection, specInput) => { if (options.maxVideoBW > spec.maxVideoBW) { options.maxVideoBW = spec.maxVideoBW; } - Logger.info('Checking subscribe options for', stream.getID()); + options.audio = (options.audio === undefined) ? true : options.audio; + options.video = (options.video === undefined) ? true : options.video; + options.data = (options.data === undefined) ? true : options.data; stream.checkOptions(options); const constraint = { streamId: stream.getID(), audio: options.audio && stream.hasAudio(), diff --git a/erizo_controller/erizoClient/src/webrtc-stacks/BaseStack.js b/erizo_controller/erizoClient/src/webrtc-stacks/BaseStack.js index 907277bd46..b5bec4de45 100644 --- a/erizo_controller/erizoClient/src/webrtc-stacks/BaseStack.js +++ b/erizo_controller/erizoClient/src/webrtc-stacks/BaseStack.js @@ -30,8 +30,8 @@ const BaseStack = (specInput) => { specBase.remoteDescriptionSet = false; that.mediaConstraints = { - offerToReceiveVideo: (specBase.video !== undefined), - offerToReceiveAudio: (specBase.audio !== undefined), + offerToReceiveVideo: (specBase.video !== undefined && specBase.video !== false), + offerToReceiveAudio: (specBase.audio !== undefined && specBase.audio !== false), }; that.peerConnection = new RTCPeerConnection(that.pcConfig, that.con);