Skip to content

Add per packet sframe option#293

Merged
youennf merged 4 commits intow3c:mainfrom
youennf:add-per-packet-sframe-option
Mar 26, 2026
Merged

Add per packet sframe option#293
youennf merged 4 commits intow3c:mainfrom
youennf:add-per-packet-sframe-option

Conversation

@youennf
Copy link
Copy Markdown
Collaborator

@youennf youennf commented Feb 4, 2026

Fixes #292


Preview | Diff

@youennf youennf force-pushed the add-per-packet-sframe-option branch from fc2dc23 to 844101b Compare February 4, 2026 14:06
1. Let |transceiver| be the {{RTCRtpTransceiver}} associated to [=this=].
1. If |transform|.`[[useSFrame]]` is true, run the following steps:
1. If |transceiver|.`[[useSFrame]]` is false, throw a {{InvalidModificationError}} and abort these steps.
1. Otherwise, if |transceiver|.`[[useSFrame]]` is undefined, run the following steps:
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@youennf Will ever useSFrame be undefined? Following the steps from the RTCRtpTransceiver initialization, it's always initialized to true/false from the sdp.

Otherwise, [=queue a task=] to run the following steps:
    1. If [=this=].`[[useSFrame]]` is undefined, set [=this=].`[[useSFrame]]` to false.

Which makes me think that we will actually always set it to false?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first commit of this PR should be reviewed separately at #252. This PR is really only about the second commit.
The principle is the following:

  1. If a transceiver is created via addTransceiver or addTrack, useSFrame is initially undefined so that the web app can set the transform in the current event loop task.
  2. If a transceiver is created by applying a remote description, useSFrame is initialised according the description.

@youennf youennf force-pushed the add-per-packet-sframe-option branch from 844101b to 63ee677 Compare February 6, 2026 09:47
[Exposed=Window]
interface RTCSFrameSenderTransform {
constructor(optional RTCSFrameTransformOptions options = {});
constructor(optional RTCSFrameSenderTransformOptions options = {});
Copy link
Copy Markdown

@k-wasniowski k-wasniowski Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@youennf
Should there be a requirement that for sender packet transformers should be applied after frame transformers?
In theory you could create RTCRtpScriptTransform with couple transformers attached like:

onrtctransform = transformer => {
  const encrypter = new RTCSFrameSenderTransform({mode: `packet`);
  transformer.readable
.pipeThrough(new TransformStream(myMetadataTransform1))
    .pipeThrough(encrypter)
    .pipeThrough(new TransformStream(myMetadataTransform2))
    .pipeTo(writable);
};

Where myMetadataTransformX should work on the frame level transformations

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RTCSFrameSenderTransform can only be used on RTCRtpSender, not as part of regular whatwg streams.

@youennf youennf force-pushed the add-per-packet-sframe-option branch from 63ee677 to e5513d5 Compare March 23, 2026 09:18
@youennf youennf force-pushed the add-per-packet-sframe-option branch from e5513d5 to 73803fb Compare March 26, 2026 15:42
Co-authored-by: Jan-Ivar Bruaroey <jan-ivar@users.noreply.github.com>
@youennf youennf merged commit 5d2c82e into w3c:main Mar 26, 2026
2 checks passed
github-actions bot added a commit that referenced this pull request Mar 26, 2026
SHA: 5d2c82e
Reason: push, by youennf

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose an API to turn on per-packet sframe native support

3 participants