Skip to content
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

Allow setting RtpEncodingParameters for individual encodings #174

Open
wants to merge 2 commits into
base: v3
Choose a base branch
from

Conversation

t-mullen
Copy link
Contributor

Description

Changes Producer::setRtpEncodingParameters to also accept an array of RTCRtpEncodingParameters, for setting different parameters for each encoding. Passing a single RTCRtpEncodingParameters object will work as before.

Usecases

I have a few uses for this - just some examples:

  1. Disabling lower-indexed encodings (similar to setMaxSpatialLayer but reversed).
  2. Modifying scaleResolutionDownBy depending on the current source resolution of the track.

parameters.encodings[idx] = { ...encoding, ...params };
});
parameters.encodings.forEach((encoding: RTCRtpEncodingParameters, idx: number) =>
{
Copy link
Member

Choose a reason for hiding this comment

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

This is wrong. Old matching properties override the new ones.

Copy link
Contributor Author

@t-mullen t-mullen Jul 14, 2021

Choose a reason for hiding this comment

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

This is the way property assignment was done before. It seems to be correct:

const oldObj = { x: 1 }
const newObj = { x: 2 }
{ ...oldObj, ...newObj } // { x: 2 }

It transpiles to:

parameters.encodings[idx] = Object.assign(Object.assign({}, encoding), params[idx]);

Which also seems right.

Copy link
Member

Choose a reason for hiding this comment

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

I'm in mobile and could be wrong. I'll review in next days. Thanks

Copy link
Member

@jmillan jmillan left a comment

Choose a reason for hiding this comment

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

LGTM

@ibc
Copy link
Member

ibc commented Nov 14, 2021

I want to re-review this, sorry for the delay, off for many weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants