From e5d03d1d11d0ac19c8590a23158ccff90e3268b2 Mon Sep 17 00:00:00 2001 From: paweldomas Date: Thu, 6 Aug 2015 10:30:12 +0200 Subject: [PATCH] Fixes GUM failure with the latest FF nightly plus cleanup. --- modules/RTC/RTCUtils.js | 64 +++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 37 deletions(-) diff --git a/modules/RTC/RTCUtils.js b/modules/RTC/RTCUtils.js index b84354ff5..dbd1331d0 100644 --- a/modules/RTC/RTCUtils.js +++ b/modules/RTC/RTCUtils.js @@ -23,21 +23,17 @@ function getPreviousResolution(resolution) { } function setResolutionConstraints(constraints, resolution, isAndroid) { - if (resolution && !constraints.video || isAndroid) { - // same behaviour as true - constraints.video = { mandatory: {}, optional: [] }; - } - if(Resolutions[resolution]) { + if (Resolutions[resolution]) { constraints.video.mandatory.minWidth = Resolutions[resolution].width; constraints.video.mandatory.minHeight = Resolutions[resolution].height; } - else { - if (isAndroid) { - constraints.video.mandatory.minWidth = 320; - constraints.video.mandatory.minHeight = 240; - constraints.video.mandatory.maxFrameRate = 15; - } + else if (isAndroid) { + // FIXME can't remember if the purpose of this was to always request + // low resolution on Android ? if yes it should be moved up front + constraints.video.mandatory.minWidth = 320; + constraints.video.mandatory.minHeight = 240; + constraints.video.mandatory.maxFrameRate = 15; } if (constraints.video.mandatory.minWidth) @@ -55,10 +51,28 @@ function getConstraints(um, resolution, bandwidth, fps, desktopStream, isAndroid if (um.indexOf('video') >= 0) { // same behaviour as true constraints.video = { mandatory: {}, optional: [] }; + + constraints.video.optional.push({ googLeakyBucket: true }); + + setResolutionConstraints(constraints, resolution, isAndroid); } if (um.indexOf('audio') >= 0) { - // same behaviour as true - constraints.audio = { mandatory: {}, optional: []}; + if (!RTCBrowserType.isFirefox()) { + // same behaviour as true + constraints.audio = { mandatory: {}, optional: []}; + // if it is good enough for hangouts... + constraints.audio.optional.push( + {googEchoCancellation: true}, + {googAutoGainControl: true}, + {googNoiseSupression: true}, + {googHighpassFilter: true}, + {googNoisesuppression2: true}, + {googEchoCancellation2: true}, + {googAutoGainControl2: true} + ); + } else { + constraints.audio = true; + } } if (um.indexOf('screen') >= 0) { if (RTCBrowserType.isChrome()) { @@ -100,30 +114,6 @@ function getConstraints(um, resolution, bandwidth, fps, desktopStream, isAndroid }; } - if (constraints.audio) { - // if it is good enough for hangouts... - constraints.audio.optional.push( - {googEchoCancellation: true}, - {googAutoGainControl: true}, - {googNoiseSupression: true}, - {googHighpassFilter: true}, - {googNoisesuppression2: true}, - {googEchoCancellation2: true}, - {googAutoGainControl2: true} - ); - } - if (constraints.video) { - if (um.indexOf('video') >= 0) { - constraints.video.optional.push( - {googLeakyBucket: true} - ); - } - } - - if (um.indexOf('video') >= 0) { - setResolutionConstraints(constraints, resolution, isAndroid); - } - if (bandwidth) { if (!constraints.video) { //same behaviour as true