-
Notifications
You must be signed in to change notification settings - Fork 26
EncodedVideoFrame needs to be marked serializable #181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The spec is using serialise with transfer as a way to copy the detach the data ownership and ensure there is no TOCTOU issue. I do not think the intent was to enable serialisation of frames. |
Thanks for explaining. I agree that unless the WG decides frames should be serializable, we need to rewrite that since neither RTCEncodedAudioFrame nor RTCEncodeVideoFrame contain the prerequisite serialization or deserialization steps necessary to have "Let serializedFrame be StructuredSerializeWithTransfer(frame, « data »)." and "Let frameCopy be StructuredDeserialize(serializedFrame, frame’s relevant realm)." work.
To save time, can this be that issue?
Does that work? |
@alvestrand's request seems based on need in the #160 use case, and now that structuredClone(value[, { transfer }]) exists in the web platform, inventing custom This would also solve whether to clone the frame buffer or not, by leaving it up to JS: const frameCopy = structuredClone(frame); // clones the data as well
const frameMove = structuredClone(frame, {transfer: [frame.data]}); // transfers the data |
This issue was mentioned in WEBRTCWG-2023-09-12 (Page 49) |
The algorithm specified seems to indicate that EncodedVideoFrame (and audio) is serializable, since it uses the serialization steps to move it around.
This means that "structuredClone(frame)" should give sensible results.
We should mark the IDL accordingly.
(Related to #161)
The text was updated successfully, but these errors were encountered: