applyConstraints bug repro steps

My starting point.

by jib1

HTML

Video 1:
<video style="display: block" id="bigVideo" autoplay></video>
<div id="video1Log"></div>
<hr />
Video 2:
<video style="display: block" id="smallVideo" autoplay></video>
<div id="video2Log"></div>
<button id="test">Start</button>
<div id="div" style="white-space: pre;"></div>

JavaScript

const console = { log: msg => div.innerHTML += msg + "<br>" };
const dump = f => console.log(`${f.toString().slice(6)} = ${JSON.stringify(f(), null, 2)}`);
const wait = ms => new Promise(resolve => setTimeout(resolve, ms));

async function test() {
  try {
    const stream = await navigator.mediaDevices.getDisplayMedia({
      video: {width: 640, height: 400}
    });
    document.getElementById('bigVideo').srcObject = stream;

    const a = stream.getVideoTracks()[0];
    dump(() => a.getSettings()); 
    b = a.clone();
    dump(() => b.getSettings()); 

    await b.applyConstraints({
      width: { max: 640 },
      height: { max: 400 },
      frameRate: 2
    });
    dump(() => b.getSettings()); 
    document.getElementById('smallVideo').srcObject = new MediaStream([b]);
    document.getElementById('video1Log').innerText = JSON.stringify(a.getSettings()) // bug - incorrect settings object
    document.getElementById('video2Log').innerText = JSON.stringify(b.getSettings()) // bug - incorrect settings object
  } catch (e) {
    console.log(e);
    return;
  }
}
document.getElementById('test').addEventListener('click', test);