3

I am using RTCMulticonnection in one of my projects. Where I want to limit video stream bandwidth to 500-600kbp. I gone through the documentation and set sdp constraints with bandwidth Handeller. and I reduced the width to 320p and height 180 using mediaConstrains. but still, 2-2.5 Mbps used in both sent and receive.

Here is the code what I am using

<script src="https://rtcmulticonnection.herokuapp.com/dist/RTCMultiConnection.min.js"></script>
<script src="https://rtcmulticonnection.herokuapp.com/socket.io/socket.io.js"></script>

<script>
var connection = new RTCMultiConnection();

// this line is VERY_important
connection.socketURL = 'https://rtcmulticonnection.herokuapp.com:443/';

// if you want audio+video conferencing
connection.session = {
    audio: true,
    video: true
};
connection.mediaConstraints = {
    audio: true,
    video: {
        mandatory: {
            minWidth: 360,
            maxWidth: 360,
            minHeight: 180,
            maxHeight: 180,
            minFrameRate: 15,
            minAspectRatio: 1.77
        }
    }
};

if (DetectRTC.browser.name === 'Firefox') {
    connection.mediaConstraints = {
        audio: true,
        video: {
            width: 360,
            height: 180,
            frameRate: 15,
            aspectRatio: 1.77
        }
    };
}
var BandwidthHandler = connection.BandwidthHandler;
connection.bandwidth = {
    audio: 90,
    video: 400,
    screen: 360
};
connection.processSdp = function(sdp) {
    sdp = BandwidthHandler.setApplicationSpecificBandwidth(sdp, connection.bandwidth, !!connection.session.screen);
    sdp = BandwidthHandler.setVideoBitrates(sdp, {
        min: connection.bandwidth.video,
        max: connection.bandwidth.video
    });

    sdp = BandwidthHandler.setOpusAttributes(sdp);

    sdp = BandwidthHandler.setOpusAttributes(sdp, {
        'stereo': 1,
        //'sprop-stereo': 1,
        'maxaveragebitrate': connection.bandwidth.audio * 1000 * 8,
        'maxplaybackrate': connection.bandwidth.audio * 1000 * 8,
        //'cbr': 1,
        //'useinbandfec': 1,
        // 'usedtx': 1,
        'maxptime': 3
    });

    return sdp;
};

connection.openOrJoin('your-room-id');
</script>

Is that anything am I doing wrong?

asimdev
  • 705
  • 1
  • 8
  • 22

1 Answers1

0

I have no experience about RTCMulticonnection.

So I just want to say about bandwidth option in SDP.

How about add value in sdp?

like 'b=AS:600'

Community
  • 1
  • 1
Jinho Jang
  • 176
  • 5