dom/media/webrtc/tests/mochitests/test_getUserMedia_nonDefaultRate.html
author Dave Townsend <dtownsend@oxymoronical.com>
Mon, 14 Jul 2025 14:08:24 +0000 (12 hours ago)
changeset 796524 2ef57d67fd0616c054a8e385c6b76d6342e81f75
parent 685312 ffb4f207949a7edcb49c4854390cff03b794227d
permissions -rw-r--r--
Bug 1975002: Ensure we fully decode images before trying to use them in the Dock or Taskbar. r=profiles-reviewers,niklas Differential Revision: https://phabricator.services.mozilla.com/D256996
<!DOCTYPE HTML>
<html>
<head>
  <script type="application/javascript" src="mediaStreamPlayback.js"></script>
</head>
<body>
<pre id="test">
<script type="application/javascript">
  createHTML({
    title: "getUserMedia feed to a graph with non default rate",
    bug: "1387454",
  });

  /**
   * Run a test to verify that when we use the streem from a gUM to an AudioContext
   * with non default rate the connection fails. (gUM is always on default rate).
   */
  runTest(async () => {
    const stream = await getUserMedia({audio: true});
    const nonDefaultRate = 32000;
    const ac = new AudioContext({sampleRate: nonDefaultRate});
    mustThrowWith(
      "Connect stream with graph of different sample rate",
      "NotSupportedError", () => {
        ac.createMediaStreamSource(stream);
      }
    );
    for (let t of stream.getTracks()) {
      t.stop();
    }
  });
</script>
</pre>
</body>
</html>