Mediasoup Bitrate limit issue with react-native

585 Views Asked by At

I’ve been trying to set a limit for the bitrate produced from mediasoup device, but it didn’t work. I did use multiple approaches, still didn’t get any result. Using the webrtc-internal observers on google chrome, I noticed that the bitrates received by the other client are reaching. For example, 2Mbit/s, which is not suitable for me.

Below are two of the approaches, I’ve used:

---------------------------------First one ---------------------------------

const videoTrack = localStream.getVideoTracks()[0];
var params = { track: videoTrack, zeroRtpOnPause: true, appData: { mediaType: ‘camera’ }, disableTrackOnPause: true };
cameraProducer = await producerLocalTransport.produce(params);
cameraProducer.setRtpEncodingParameters({ active: true, maxBitrate: 50000 });

---------------------------------Second one------------------------------

const videoTrack = localStream.getVideoTracks()[0];
var params = { track: videoTrack,encodings:[{maxBitrate: 50000}], zeroRtpOnPause: true, appData: { mediaType: ‘camera’ }, disableTrackOnPause: true };
cameraProducer = await producerLocalTransport.produce(params);

Can anyone help? Thanks in advance.

1

There are 1 best solutions below

0
On

You need set video constraints when getUserMedia, resolution and frameRate must have a fine tunning so you can decrease bandwidth.

There are some good tricks: auto-mute audio and video when speaker stop speaks, and auto-unmute when he start speakes again, this will save much bandwidth, decrease cpu (server usage).