- From: youennf via GitHub <sysbot+gh@w3.org>
- Date: Fri, 29 Sep 2023 11:36:33 +0000
- To: public-webrtc-logs@w3.org
By default, it is up to the UA to not trigger too many key frames.
If the web app wants to handle it itself, it could be something like:
```
let isKeyFrameInflight = false;
const reader = transformer.readable.getReader();
const writer = transformer.writable.getWriter();
transformer.onKeyFrameRequest = async (e) => {
e.preventDefault();
// Do not ask for multiple key frames.
if (isKeyFrameInflight)
return;
isKeyFrameInflight = true;
await transformer.generateKeyFrame();
isKeyFrameInflight = false;
}
```
And skipping of frames could be done like:
```
async function doTransform()
{
const chunk = await reader.read();
if (chunk.done)
return;
// Do not write chunks if we are waiting for a key frame.
if (!isKeyFrameInflight) {
await transformChunk(chunk.value);
await writer.write(chunk.value);
}
return doTransform();
}
```
Does this look ok?
--
GitHub Notification of comment by youennf
Please view or discuss this issue at https://github.com/w3c/webrtc-encoded-transform/issues/206#issuecomment-1740747892 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Friday, 29 September 2023 11:36:34 UTC