Reputation: 7566
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??
Upvotes: 3
Views: 4047
Reputation: 1008
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.
Upvotes: 1
Reputation: 7566
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.
Upvotes: 1