Bug 979649 - Part 3: Restore Windows clock drift in RTCP timestamp test. r=jib
authorChris Peterson <cpeterson@mozilla.com>
Wed, 03 Oct 2018 23:13:10 -0700
changeset 490738 47a7b32e57373e38139dd540394fd527442e59a2
parent 490737 bd15c0cbc18ab4fc6dcac68c8be86a88e1ee7e76
child 490739 f4c2c10af6324ae04b53d18fff97eaec3e5e4396
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersjib
bugs979649
milestone65.0a1
Bug 979649 - Part 3: Restore Windows clock drift in RTCP timestamp test. r=jib The Windows clock drift allowance was originally added for Windows XP (in bug 979649). I removed it in https://hg.mozilla.org/mozilla-central/rev/a1f769e90937 but it appears Windows 7 has the same clock drift problem that XP had. Differential Revision: https://phabricator.services.mozilla.com/D9354
dom/media/tests/mochitest/pc.js
--- a/dom/media/tests/mochitest/pc.js
+++ b/dom/media/tests/mochitest/pc.js
@@ -1773,23 +1773,27 @@ PeerConnectionWrapper.prototype = {
 
   /**
    * Checks that we are getting the media streams we expect.
    *
    * @param {object} stats
    *        The stats to check from this PeerConnectionWrapper
    */
   checkStats : function(stats, twoMachines) {
+    // Allow for clock drift observed on Windows 7. (Bug 979649)
+    const isWin7 = navigator.userAgent.includes("Windows NT 6.1");
+    const clockDriftAllowance = isWin7 ? 1000 : 0;
+
     // Use spec way of enumerating stats
     var counters = {};
     for (let [key, res] of stats) {
       info("Checking stats for " + key + " : " + res);
       // validate stats
       ok(res.id == key, "Coherent stats id");
-      var nowish = Date.now();
+      var nowish = Date.now() + clockDriftAllowance;
       var minimum = this.whenCreated;
       if (false) { // Bug 1325430 - timestamps aren't working properly in update 49
       // if (!twoMachines) {
         // Bug 1225729: On android, sometimes the first RTCP of the first
         // test run gets this value, likely because no RTP has been sent yet.
         if (res.timestamp != 2085978496000) {
           ok(res.timestamp >= minimum,
              "Valid " + (res.isRemote? "rtcp" : "rtp") + " timestamp " +