Browse Source

fix: Ignore the bitrate in the first 5 seconds.

master
Boris Grozev 8 years ago
parent
commit
3532333ef4
1 changed files with 10 additions and 3 deletions
  1. 10
    3
      modules/connectivity/ConnectionQuality.js

+ 10
- 3
modules/connectivity/ConnectionQuality.js View File

@@ -42,6 +42,13 @@ var startBitrate = 800;
42 42
  * video started.
43 43
  */
44 44
 function getTarget(simulcast, resolution, millisSinceStart) {
45
+    // Completely ignore the bitrate in the first 5 seconds, as the first
46
+    // event seems to fire very early and the value is suspicious and causes
47
+    // false positives.
48
+    if (millisSinceStart < 5000) {
49
+        return 1;
50
+    }
51
+
45 52
     let target = 0;
46 53
     let height = Math.min(resolution.height, resolution.width);
47 54
 
@@ -76,9 +83,9 @@ function getTarget(simulcast, resolution, millisSinceStart) {
76 83
         }
77 84
     }
78 85
 
79
-    // Allow for an additional 3 seconds for ramp up -- delay any initial drop
80
-    // of connection quality by 3 seconds.
81
-    return Math.min(target, rampUp(Math.max(0, millisSinceStart - 3000)));
86
+    // Allow for an additional 1 second for ramp up -- delay any initial drop
87
+    // of connection quality by 1 second.
88
+    return Math.min(target, rampUp(Math.max(0, millisSinceStart - 1000)));
82 89
 }
83 90
 
84 91
 /**

Loading…
Cancel
Save