Skip to content

Setting priority on RTC session sender's encodings #873

Description

@marcovidonis

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions