dom/media/mediasource/test/test_DrainOnMissingData_mp4.html
author Jon Coppeard <jcoppeard@mozilla.com>
Fri, 21 Jun 2019 11:11:29 -0700
changeset 479906 ec4aac5a6c9f6b0172894a44bed7ad3393bfbae0
parent 469641 ba6f655fd68963530c866d0d4a48c3db3d307777
permissions -rw-r--r--
Bug 1557771 - Trigger fewer GCs via nsJSContext::MaybeRunNextCollectorSlice r=smaug This patch changes MaybeRunNextCollectorSlice so that it doesn't start a new GC/CC if one is not running already. This reduces the number of GC slices when running the benchmark from ~400 to ~230. Olli, what do you think? It seems to me that this is closer to the original intention of the code. I haven't run this through perfherder because I haven't worked out what try command I need to do this, but I figure that it won't make things worse. Differential Revision: https://phabricator.services.mozilla.com/D35556

<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
  <title>MSE: |waiting| event when source data is missing</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <script type="text/javascript" src="mediasource.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test"><script class="testbody" type="text/javascript">

SimpleTest.waitForExplicitFinish();

runWithMSE(async (ms, el) => {
  el.controls = true;
  await once(ms, "sourceopen");
  ok(true, "Receive a sourceopen event");
  const videosb = ms.addSourceBuffer("video/mp4");
  await fetchAndLoad(videosb, "bipbop/bipbop_video", ["init"], ".mp4");
  // Set appendWindowEnd to ensure we only have about 6 frames worth.
  // We must feed at least 6 frames to pass the MDSM pre-roll.
  videosb.appendWindowEnd = .4;
  await fetchAndLoad(videosb, "bipbop/bipbop_video", ["1"], ".m4s");
  info("Invoking play()");
  const p = once(el, "playing");
  await el.play();
  await p;
  info("got playing");
  await once(el, "waiting");
  info("got waiting");
  info("Loading more data");
  // Waiting will be fired on the last frame +- 40ms.
  isfuzzy(el.currentTime, videosb.buffered.end(0) - 1 / 30,
          0.04, `Got a waiting event at ${el.currentTime}`);
  videosb.appendWindowEnd = 1;
  await fetchAndLoad(videosb, "bipbop/bipbop_video", [1], ".m4s");
  ms.endOfStream();
  await once(el, "ended");
  // These fuzz factors are bigger than they should be. We should investigate
  // and fix them in bug 1137574.
  is(el.duration, 0.801666, "Video has correct duration: " + el.duration);
  is(el.currentTime, el.duration, "Video has correct currentTime.");
  SimpleTest.finish();
});

</script>
</pre>
</body>
</html>