3

I am trying to reduce the bitrate in a RTCPeerConnection within FireFox. I have successfully been able to do within Chrome.

I am modifying the SDP string that is automatically generated by FireFox after calling the createOffer method. My callback modifies the SDP and then tries to set the SDP in the RTCSessionDescription that is generated(which is just a DOMString according to the protocol spec). In Chrome, I can modify that SDP string and then set it(done within a callback passed to createOffer:

desc.sdp = TransFormSDP(desc.sdp);
connection.setLocalDescription(desc);

However, this does not seem to be working in FireFox, it will not update the SDP after my assignment and continues to utilize the string that was generated by the createOffer method.

Specifically, I am trying to specifically add an fmtp: max-fr=15; max-fs=400; restriction on the VP8 codec being offered and the bandwidth by adding b=AS:512 line in the video media portion of the SDP.

Does FF not allow you to modify the SDP after it has been automatically generated? Or Does FireFox disallow specific SDP options that are part of SDP's standardization(like bandwidth limits and codec settings)?

EDIT: Seriously FireFox??

Muath
  • 4,351
  • 12
  • 42
  • 69
Benjamin Trent
  • 7,378
  • 3
  • 31
  • 41

2 Answers2

1

Well, it seems that for now it is not supported, at least I am assuming so because there is yet to be a response to this bug. Guess I am stuck using Chrome for now.

Benjamin Trent
  • 7,378
  • 3
  • 31
  • 41
  • If somebody has a better answer, please supply one. I will accept my fate of not using FF in two days when I can accept my own answer... :( – Benjamin Trent Apr 09 '14 at 21:46
  • As far as I know, it is still a bug and Mozilla has not addressed it. – Benjamin Trent Feb 24 '15 at 18:09
  • It seems as of 2016 Jan, this is not (yet) supported by Firefox 48: [ref](https://groups.google.com/forum/#!topic/mozilla.dev.media/Rhf3W7j1F00) – Jokester Aug 10 '16 at 16:51
  • Firefox developers do not seem to be interested at all in making webRTC working according to specs. Still, it is not possible to change the bandwidth in the SDP. Audio will stay at 40 kBit/s no matter what you do. It really is a shame. – Armin Hierstetter Mar 15 '17 at 15:50
1

Actually, the bitrate of the codec encoding is available throught the API, however it doesn't work very well on Firefox.

The proper API should be the one described in the specs https://www.w3.org/TR/webrtc/#dom-rtcrtpencodingparameters

RTCRtpSender.setParameters is supported in Firefox from version 64. But actually (v.66) does not support it correctly, bitrate works, but fps doesn't.

The API way snippet to modify the bitrate:

const sender = peerConnection.getSenders().filter(s => s.track.kind === 'video')[0];
sender.setParameters({...(sender.getParameters()), encodings: [{
    maxBitrate: 1000*50,
}]});

However, chaging the bitrate throught the API has only a temporary effect in FF, as presented on the diagram below. The bitrate goes back to the default one after few seconds. The reason is not clear, probably it might be connected with the degradationPreference codec property since it acts differently for balanced, maintain-framerate and maintain-resolution. On chrome,​ it works normally.

enter image description here

  • that does not correspond with the behaviour on https://webrtc.github.io/samples/src/content/peerconnection/bandwidth/ -- if you see such behaviour please file a bug against firefox. – Philipp Hancke Apr 20 '19 at 21:48