Reputation: 25034
when initializing / renegotiating a call, and creating offer/answer sdp using PeerConnection's createOffer
/createAnswer
, before setting the sdp using, setLocalDescription
, I modify it as:
// inside createOffer/createAnswer
sdp.sdp = modifySDP(sdp.sdp);
pc.setLocalDescription(sdp, function...
...
// setting video bandwidth as 100kbps and audio as 50kbps.
function modifySDP(sdp){
sdp = sdp.replace(/a=mid:video\r\n/g, 'a=mid:video\r\nb=AS:100\r\n');
sdp = sdp.replace(/a=mid:audio\r\n/g, 'a=mid:audio\r\nb=AS:50\r\n');
return sdp;
}
After few tests, I realized that firefox does not support this modification, already reported as bug
But what suprised me was, chrome behaviour. Initially because I was setting bandwidth restrictions on both sides, so I did not notice this( later I applied the restrictions only on the offerer's side). My assumption was that that, when you set SDP on a PeerConnection, the restrictions apply to the outgoing streams, but what I noticed was, the restrictions got applied to the incoming streams. Is this the expected behaviour?
Upvotes: 0
Views: 1262
Reputation: 96
This is the expected behavior and this is what I get when I use a bandwidth limitation:
If the bandwidth attribute is present for a stream in the sdp offer, it indicates the desired bandwidth that the offerer would like to receive.
The answerer MAY include a bandwidth attribute for any media stream; this indicates the bandwidth that the answerer would like the offerer to use when sending media.
So what you've got is the expected behavior.
Upvotes: 2