Setting priority on RTC session sender's encodings
I'm looking at adding the option to set the sender's priority when adding local media stream tracks to the peer connection in RTCSession. In some applications, this could be used as a QoS marker, to make sure the user agent allocates a higher bandwidth, for example.
The way I would do it this:
this._localMediaStream = stream;
if (stream)
{
stream.getTracks().forEach((track) =>
{
let sender = this._connection.addTrack(track, stream);
const params = sender.getParameters();
params.encodings = params.encodings.map((e) => {
if (!this.priority) return e;
if (e.priority) {
e.priority = this.priority;
}
if (e.networkPriority) {
e.networkPriority = this.priority;
}
return e;
});
sender.setParameters(params);
});
}
Would this addition be of interested to the project? If so, I'd be happy to open a PR for it.
Also, I'm not too sure where the best place would be to define this.priority: in RTCSession.js itself, perhaps? Or better pass it to the constructor?
I've verified This works in Chrome ( 130.0.6723.117) but does not work in Safari (17.x) - both desktop and mobile (rdcp is set to 0 - can be checked in wireshark capture).
I'm curious when/if this will get merged. The attached PR looks good to me and we've been using it as a patch for some time now.