Browse Source

Fixes GUM failure with the latest FF nightly plus cleanup.

master
paweldomas 10 years ago
parent
commit
e5d03d1d11
1 changed files with 27 additions and 37 deletions
  1. 27
    37
      modules/RTC/RTCUtils.js

+ 27
- 37
modules/RTC/RTCUtils.js View File

@@ -23,21 +23,17 @@ function getPreviousResolution(resolution) {
23 23
 }
24 24
 
25 25
 function setResolutionConstraints(constraints, resolution, isAndroid) {
26
-    if (resolution && !constraints.video || isAndroid) {
27
-        // same behaviour as true
28
-        constraints.video = { mandatory: {}, optional: [] };
29
-    }
30 26
 
31
-    if(Resolutions[resolution]) {
27
+    if (Resolutions[resolution]) {
32 28
         constraints.video.mandatory.minWidth = Resolutions[resolution].width;
33 29
         constraints.video.mandatory.minHeight = Resolutions[resolution].height;
34 30
     }
35
-    else {
36
-        if (isAndroid) {
37
-            constraints.video.mandatory.minWidth = 320;
38
-            constraints.video.mandatory.minHeight = 240;
39
-            constraints.video.mandatory.maxFrameRate = 15;
40
-        }
31
+    else if (isAndroid) {
32
+        // FIXME can't remember if the purpose of this was to always request
33
+        //       low resolution on Android ? if yes it should be moved up front
34
+        constraints.video.mandatory.minWidth = 320;
35
+        constraints.video.mandatory.minHeight = 240;
36
+        constraints.video.mandatory.maxFrameRate = 15;
41 37
     }
42 38
 
43 39
     if (constraints.video.mandatory.minWidth)
@@ -55,10 +51,28 @@ function getConstraints(um, resolution, bandwidth, fps, desktopStream, isAndroid
55 51
     if (um.indexOf('video') >= 0) {
56 52
         // same behaviour as true
57 53
         constraints.video = { mandatory: {}, optional: [] };
54
+
55
+        constraints.video.optional.push({ googLeakyBucket: true });
56
+
57
+        setResolutionConstraints(constraints, resolution, isAndroid);
58 58
     }
59 59
     if (um.indexOf('audio') >= 0) {
60
-        // same behaviour as true
61
-        constraints.audio = { mandatory: {}, optional: []};
60
+        if (!RTCBrowserType.isFirefox()) {
61
+            // same behaviour as true
62
+            constraints.audio = { mandatory: {}, optional: []};
63
+            // if it is good enough for hangouts...
64
+            constraints.audio.optional.push(
65
+                {googEchoCancellation: true},
66
+                {googAutoGainControl: true},
67
+                {googNoiseSupression: true},
68
+                {googHighpassFilter: true},
69
+                {googNoisesuppression2: true},
70
+                {googEchoCancellation2: true},
71
+                {googAutoGainControl2: true}
72
+            );
73
+        } else {
74
+            constraints.audio = true;
75
+        }
62 76
     }
63 77
     if (um.indexOf('screen') >= 0) {
64 78
         if (RTCBrowserType.isChrome()) {
@@ -100,30 +114,6 @@ function getConstraints(um, resolution, bandwidth, fps, desktopStream, isAndroid
100 114
         };
101 115
     }
102 116
 
103
-    if (constraints.audio) {
104
-        // if it is good enough for hangouts...
105
-        constraints.audio.optional.push(
106
-            {googEchoCancellation: true},
107
-            {googAutoGainControl: true},
108
-            {googNoiseSupression: true},
109
-            {googHighpassFilter: true},
110
-            {googNoisesuppression2: true},
111
-            {googEchoCancellation2: true},
112
-            {googAutoGainControl2: true}
113
-        );
114
-    }
115
-    if (constraints.video) {
116
-        if (um.indexOf('video') >= 0) {
117
-            constraints.video.optional.push(
118
-                {googLeakyBucket: true}
119
-            );
120
-        }
121
-    }
122
-
123
-    if (um.indexOf('video') >= 0) {
124
-        setResolutionConstraints(constraints, resolution, isAndroid);
125
-    }
126
-
127 117
     if (bandwidth) {
128 118
         if (!constraints.video) {
129 119
             //same behaviour as true

Loading…
Cancel
Save