Bug 1065215 - Fix EME test for changes to MediaSource::endOfStream - r=cpearce
authorChris Double <chris.double@double.co.nz>
Wed, 19 Nov 2014 17:16:59 +1300
changeset 240889 2be3cdd2ed7cbe46e11b8fb7a29b914611537935
parent 240888 dc01d68c1c7a7f56497ce7a5f87aeaf243ecf835
child 240890 2beca8e05628512f05d8e10ba715238670bb2dff
push id4311
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 19:37:41 +0000
treeherdermozilla-beta@150c9fed433b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1065215
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1065215 - Fix EME test for changes to MediaSource::endOfStream - r=cpearce
dom/media/test/eme.js
--- a/dom/media/test/eme.js
+++ b/dom/media/test/eme.js
@@ -116,16 +116,25 @@ function PlayFragmented(test, elem, toke
   return new Promise(function(resolve, reject) {
     var ms = new MediaSource();
     elem.src = URL.createObjectURL(ms);
 
     var sb;
     var curFragment = 0;
 
     function addNextFragment() {
+      /* We can get another updateevent as a result of calling ms.endOfStream() if
+         the highest end time of our source buffers is different from that of the
+         media source duration. Due to bug 1065207 this can happen because of
+         inaccuracies in the frame duration calculations. Check if we are already
+         "ended" and ignore the update event */
+      if (ms.readyState == "ended") {
+        return;
+      }
+
       if (curFragment >= test.fragments.length) {
         Log(token, "addNextFragment() end of stream");
         ms.endOfStream();
         resolve();
         return;
       }
 
       var fragmentFile = test.fragments[curFragment++];