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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Producer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export declare class Producer extends EnhancedEventEmitter {
/**
* Sets the DSCP value.
*/
setRtpEncodingParameters(params: RTCRtpEncodingParameters): Promise<void>;
setRtpEncodingParameters(params: RTCRtpEncodingParameters | RTCRtpEncodingParameters[]): Promise<void>;
private _onTrackEnded;
private _handleTrack;
private _destroyTrack;
Expand Down
2 changes: 1 addition & 1 deletion lib/Producer.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/handlers/Chrome67.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 10 additions & 3 deletions lib/handlers/Chrome67.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,16 @@ class Chrome67 extends HandlerInterface_1.HandlerInterface {
if (!rtpSender)
throw new Error('associated RTCRtpSender not found');
const parameters = rtpSender.getParameters();
parameters.encodings.forEach((encoding, idx) => {
parameters.encodings[idx] = Object.assign(Object.assign({}, encoding), params);
});
if (Array.isArray(params)) {
parameters.encodings.forEach((encoding, idx) => {
parameters.encodings[idx] = Object.assign(Object.assign({}, encoding), params[idx]);
});
}
else {
parameters.encodings.forEach((encoding, idx) => {
parameters.encodings[idx] = Object.assign(Object.assign({}, encoding), params);
});
}
await rtpSender.setParameters(parameters);
}
async getSenderStats(localId) {
Expand Down
2 changes: 1 addition & 1 deletion lib/handlers/Chrome70.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 10 additions & 3 deletions lib/handlers/Chrome70.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,16 @@ class Chrome70 extends HandlerInterface_1.HandlerInterface {
if (!transceiver)
throw new Error('associated RTCRtpTransceiver not found');
const parameters = transceiver.sender.getParameters();
parameters.encodings.forEach((encoding, idx) => {
parameters.encodings[idx] = Object.assign(Object.assign({}, encoding), params);
});
if (Array.isArray(params)) {
parameters.encodings.forEach((encoding, idx) => {
parameters.encodings[idx] = Object.assign(Object.assign({}, encoding), params[idx]);
});
}
else {
parameters.encodings.forEach((encoding, idx) => {
parameters.encodings[idx] = Object.assign(Object.assign({}, encoding), params);
});
}
await transceiver.sender.setParameters(parameters);
}
async getSenderStats(localId) {
Expand Down
Loading