Переглянути джерело

secret sauce GUM flags

j8
Philipp Hancke 11 роки тому
джерело
коміт
794296198c
1 змінених файлів з 27 додано та 4 видалено
  1. 27
    4
      libs/strophe/strophe.jingle.adapter.js

+ 27
- 4
libs/strophe/strophe.jingle.adapter.js Переглянути файл

@@ -513,7 +513,7 @@ function getUserMediaWithConstraints(um, success_callback, failure_callback, res
513 513
         constraints.video = { mandatory: {}, optional: [] };// same behaviour as true
514 514
     }
515 515
     if (um.indexOf('audio') >= 0) {
516
-        constraints.audio = {};// same behaviour as true
516
+        constraints.audio = { mandatory: {}, optional: []};// same behaviour as true
517 517
     }
518 518
     if (um.indexOf('screen') >= 0) {
519 519
         constraints.video = {
@@ -541,6 +541,29 @@ function getUserMediaWithConstraints(um, success_callback, failure_callback, res
541 541
         }
542 542
     }
543 543
 
544
+    if (constraints.audio) {
545
+        // if it is good enough for hangouts...
546
+        constraints.audio.optional.push(
547
+            {googEchoCancellation: true},
548
+            {googAutoGainControl: true},
549
+            {googNoiseSupression: true},
550
+            {googHighpassFilter: true},
551
+            {googNoisesuppression2: true},
552
+            {googEchoCancellation2: true},
553
+            {googAutoGainControl2: true}
554
+        );
555
+    }
556
+    if (constraints.video) {
557
+        constraints.video.optional.push(
558
+            {googNoiseReduction: true}
559
+        );
560
+        if (um.indexOf('video') >= 0) {
561
+            constraints.video.optional.push(
562
+                {googLeakyBucket: true}
563
+            );
564
+        }
565
+    }
566
+
544 567
     // Check if we are running on Android device
545 568
     var isAndroid = navigator.userAgent.indexOf('Android') != -1;
546 569
 
@@ -596,12 +619,12 @@ function getUserMediaWithConstraints(um, success_callback, failure_callback, res
596 619
     }
597 620
 
598 621
     if (bandwidth) { // doesn't work currently, see webrtc issue 1846
599
-        if (!constraints.video) constraints.video = {mandatory: {}};//same behaviour as true
600
-        constraints.video.optional = [{bandwidth: bandwidth}];
622
+        if (!constraints.video) constraints.video = {mandatory: {}, optional: []};//same behaviour as true
623
+        constraints.video.optional.push({bandwidth: bandwidth});
601 624
     }
602 625
     if (fps) { // for some cameras it might be necessary to request 30fps
603 626
         // so they choose 30fps mjpg over 10fps yuy2
604
-        if (!constraints.video) constraints.video = {mandatory: {}};// same behaviour as tru;
627
+        if (!constraints.video) constraints.video = {mandatory: {}, optional: []};// same behaviour as true;
605 628
         constraints.video.mandatory.minFrameRate = fps;
606 629
     }
607 630
 

Завантаження…
Відмінити
Зберегти