Bug 1180935: P2. Update mochitests due to new reader behaviour. r=cpearce a=ritu
☠☠ backed out by 5bb661db5c6c ☠ ☠
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 12 Aug 2015 21:24:53 +1000
changeset 288959 6613d06f28bc376578edb759852683e34f615c79
parent 288958 45f3c6119bcaa5e6983e1baef92c6b37bc17e34a
child 288960 e9142a9acf59316005522e57e0826488ca971098
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce, ritu
bugs1180935
milestone42.0a2
Bug 1180935: P2. Update mochitests due to new reader behaviour. r=cpearce a=ritu
dom/media/mediasource/test/test_BufferingWait_mp4.html
dom/media/mediasource/test/test_WaitingOnMissingData_mp4.html
dom/media/mediasource/test/test_WaitingToEndedTransition_mp4.html
--- a/dom/media/mediasource/test/test_BufferingWait_mp4.html
+++ b/dom/media/mediasource/test/test_BufferingWait_mp4.html
@@ -36,24 +36,28 @@ runWithMSE(function(ms, v) {
     sb.addEventListener('error', (e) => { ok(false, "Got Error: " + e); SimpleTest.finish(); });
     fetchAndLoad(sb, 'bipbop/bipbop', ['init'], '.mp4')
     .then(fetchAndLoad.bind(null, sb, 'bipbop/bipbop', ['1'], '.m4s'))
     .then(fetchAndLoad.bind(null, sb, 'bipbop/bipbop', ['2'], '.m4s'))
     /* Note - Missing |bipbop3| segment here corresponding to (1.62, 2.41] */
     /* Note - Missing |bipbop4| segment here corresponding to (2.41, 3.20]  */
     .then(fetchAndLoad.bind(null, sb, 'bipbop/bipbop', ['5'], '.m4s'))
     .then(function() {
-        var promise = waitUntilTime(1.4);
+        // Some decoders (Windows in particular) may keep up to 25 frames queued
+        // before returning a sample. 0.7 is 1.62s - 25 * 0.03333
+        var promise = waitUntilTime(0.7);
         info("Playing video. It should play for a bit, then fire 'waiting'");
         v.play();
         return promise;
       }).then(function() {
         window.firstStop = Date.now();
         fetchAndLoad(sb, 'bipbop/bipbop', ['3'], '.m4s');
-        return waitUntilTime(2.2);
+        // Some decoders (Windows in particular) may keep up to 25 frames queued
+        // before returning a sample. 1.5 is 2.41s - 25 * 0.03333
+        return waitUntilTime(1.5);
       }).then(function() {
         var waitDuration = (Date.now() - window.firstStop) / 1000;
         ok(waitDuration < 15, "Should not spend an inordinate amount of time buffering: " + waitDuration);
         once(v, 'ended', SimpleTest.finish.bind(SimpleTest));
         return fetchAndLoad(sb, 'bipbop/bipbop', ['4'], '.m4s');
       }).then(function() {
         ms.endOfStream();
       });;
--- a/dom/media/mediasource/test/test_WaitingOnMissingData_mp4.html
+++ b/dom/media/mediasource/test/test_WaitingOnMissingData_mp4.html
@@ -35,18 +35,19 @@ runWithMSE(function(ms, el) {
       ok(true, "Video playing. It should play for a bit, then fire 'waiting'");
       var p = once(el, 'waiting');
       el.play();
       return p;
     }).then(function() {
       // currentTime is based on the current video frame, so if the audio ends just before
       // the next video frame, currentTime can be up to 1 frame's worth earlier than
       // min(audioEnd, videoEnd).
+      // Some decoders (Windows in particular) may keep up to 25 frames queued.
       isfuzzy(el.currentTime, Math.min(audiosb.buffered.end(0), videosb.buffered.end(0)) - 1/60,
-              1/30, "Got a waiting event at " + el.currentTime);
+              25 * 1/30, "Got a waiting event at " + el.currentTime);
       info("Loading more data");
       var p = once(el, 'ended');
       var loads = Promise.all([fetchAndLoad(audiosb, 'bipbop/bipbop_audio', [5], '.m4s'),
                                fetchAndLoad(videosb, 'bipbop/bipbop_video', [6], '.m4s')]);
       loads.then(() => ms.endOfStream());
       return p;
     }).then(function() {
       // These fuzz factors are bigger than they should be. We should investigate
--- a/dom/media/mediasource/test/test_WaitingToEndedTransition_mp4.html
+++ b/dom/media/mediasource/test/test_WaitingToEndedTransition_mp4.html
@@ -33,18 +33,19 @@ runWithMSE(function(ms, el) {
       ok(true, "Video playing. It should play for a bit, then fire 'waiting'");
       var p = once(el, 'waiting');
       el.play();
       return p;
     }).then(function() {
       // currentTime is based on the current video frame, so if the audio ends just before
       // the next video frame, currentTime can be up to 1 frame's worth earlier than
       // min(audioEnd, videoEnd).
+      // Some decoders (Windows in particular) may keep up to 25 frames queued.
       isfuzzy(el.currentTime, Math.min(audiosb.buffered.end(0), videosb.buffered.end(0)) - 1/60,
-              1/30, "Got a waiting event at " + el.currentTime);
+              25 * 1/30, "Got a waiting event at " + el.currentTime);
     }).then(function() {
       var p = once(el, 'ended');
       ms.endOfStream();
       return p;
     }).then(function() {
       is(el.duration, 4.005, "Video has correct duration: " + el.duration);
       is(el.currentTime, el.duration, "Video has correct currentTime.");
       SimpleTest.finish();