Hiii
I am using Kurento media server in my webrtc Project. I am want to Increase Video Quality for my web call.
setmaxsend/recbandwith() is not working for value over 500 kb.
I want to change max bandwidth tell me how can do that.
what I need:
My Sdp
v=0\r\n' +
'o=- 594779498531068541 2 IN IP4 127.0.0.1\r\n' +
's=-\r\n' +
't=0 0\r\n' +
'a=group:BUNDLE 0 1\r\n' +
'a=msid-semantic: WMS yLSrYTOKMcyDlIv8Sqhr5RW0DNPgo984JnC1\r\n' +
'm=audio 9 UDP/TLS/RTP/SAVPF 111 103 104 9 0 8 106 105 13 110 112 113 126\r\n' +
'c=IN IP4 0.0.0.0\r\n' +
'a=rtcp:9 IN IP4 0.0.0.0\r\n' +
'a=ice-ufrag:nSy7\r\n' +
'a=ice-pwd:RM/BPZmvUexKN0Sjm+/hCIbz\r\n' +
'a=ice-options:trickle\r\n' +
'a=fingerprint:sha-256 46:C6:8C:6A:ED:6C:C0:13:CC:EB:6E:D0:A3:76:12:DA:87:D6:B2:B8:D3:29:F8:CB:D3:FF:FE:96:BF:8F:F3:A6\r\n' +
'a=setup:actpass\r\n' +
'a=mid:0\r\n' +
'a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\n' +
'a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\n' +
'a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\n' +
'a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid\r\n' +
'a=extmap:5 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id\r\n' +
'a=extmap:6 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id\r\n' +
'a=sendrecv\r\n' +
'a=msid:yLSrYTOKMcyDlIv8Sqhr5RW0DNPgo984JnC1 eb8b778d-91b1-4c0f-b176-3dcc4dff00e0\r\n' +
'a=rtcp-mux\r\n' +
'a=rtpmap:111 opus/48000/2\r\n' +
'a=rtcp-fb:111 transport-cc\r\n' +
'a=fmtp:111 minptime=10;useinbandfec=1\r\n' +
'a=rtpmap:103 ISAC/16000\r\n' +
'a=rtpmap:104 ISAC/32000\r\n' +
'a=rtpmap:9 G722/8000\r\n' +
'a=rtpmap:0 PCMU/8000\r\n' +
'a=rtpmap:8 PCMA/8000\r\n' +
'a=rtpmap:106 CN/32000\r\n' +
'a=rtpmap:105 CN/16000\r\n' +
'a=rtpmap:13 CN/8000\r\n' +
'a=rtpmap:110 telephone-event/48000\r\n' +
'a=rtpmap:112 telephone-event/32000\r\n' +
'a=rtpmap:113 telephone-event/16000\r\n' +
'a=rtpmap:126 telephone-event/8000\r\n' +
'a=ssrc:3075742303 cname:XuMK8Lp2rvft5uMI\r\n' +
'a=ssrc:3075742303 msid:yLSrYTOKMcyDlIv8Sqhr5RW0DNPgo984JnC1 eb8b778d-91b1-4c0f-b176-3dcc4dff00e0\r\n' +
'a=ssrc:3075742303 mslabel:yLSrYTOKMcyDlIv8Sqhr5RW0DNPgo984JnC1\r\n' +
'a=ssrc:3075742303 label:eb8b778d-91b1-4c0f-b176-3dcc4dff00e0\r\n' +
'm=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 102 121 127 120 125 107 108 109 124 119 123 118 114 115 116\r\n' +
'c=IN IP4 0.0.0.0\r\n' +
'a=rtcp:9 IN IP4 0.0.0.0\r\n' +
'a=ice-ufrag:nSy7\r\n' +
'a=ice-pwd:RM/BPZmvUexKN0Sjm+/hCIbz\r\n' +
'a=ice-options:trickle\r\n' +
'a=fingerprint:sha-256 46:C6:8C:6A:ED:6C:C0:13:CC:EB:6E:D0:A3:76:12:DA:87:D6:B2:B8:D3:29:F8:CB:D3:FF:FE:96:BF:8F:F3:A6\r\n' +
'a=setup:actpass\r\n' +
'a=mid:1\r\n' +
'a=extmap:14 urn:ietf:params:rtp-hdrext:toffset\r\n' +
'a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\n' +
'a=extmap:13 urn:3gpp:video-orientation\r\n' +
'a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\n' +
'a=extmap:12 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay\r\n' +
'a=extmap:11 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type\r\n' +
'a=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-timing\r\n' +
'a=extmap:8 http://www.webrtc.org/experiments/rtp-hdrext/color-space\r\n' +
'a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid\r\n' +
'a=extmap:5 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id\r\n' +
'a=extmap:6 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id\r\n' +
'a=sendrecv\r\n' +
'a=msid:yLSrYTOKMcyDlIv8Sqhr5RW0DNPgo984JnC1 a0a25d11-697e-4b2d-bf43-60c9e59291d6\r\n' +
'a=rtcp-mux\r\n' +
'a=rtcp-rsize\r\n' +
'a=rtpmap:96 VP8/90000\r\n' +
'a=rtcp-fb:96 goog-remb\r\n' +
'a=rtcp-fb:96 transport-cc\r\n' +
'a=rtcp-fb:96 ccm fir\r\n' +
'a=rtcp-fb:96 nack\r\n' +
'a=rtcp-fb:96 nack pli\r\n' +
'a=rtpmap:97 rtx/90000\r\n' +
'a=fmtp:97 apt=96\r\n' +
'a=rtpmap:98 VP9/90000\r\n' +
'a=rtcp-fb:98 goog-remb\r\n' +
'a=rtcp-fb:98 transport-cc\r\n' +
'a=rtcp-fb:98 ccm fir\r\n' +
'a=rtcp-fb:98 nack\r\n' +
'a=rtcp-fb:98 nack pli\r\n' +
'a=fmtp:98 profile-id=0\r\n' +
'a=rtpmap:99 rtx/90000\r\n' +
'a=fmtp:99 apt=98\r\n' +
'a=rtpmap:100 VP9/90000\r\n' +
'a=rtcp-fb:100 goog-remb\r\n' +
'a=rtcp-fb:100 transport-cc\r\n' +
'a=rtcp-fb:100 ccm fir\r\n' +
'a=rtcp-fb:100 nack\r\n' +
'a=rtcp-fb:100 nack pli\r\n' +
'a=fmtp:100 profile-id=2\r\n' +
'a=rtpmap:101 rtx/90000\r\n' +
'a=fmtp:101 apt=100\r\n' +
'a=rtpmap:102 H264/90000\r\n' +
'a=rtcp-fb:102 goog-remb\r\n' +
'a=rtcp-fb:102 transport-cc\r\n' +
'a=rtcp-fb:102 ccm fir\r\n' +
'a=rtcp-fb:102 nack\r\n' +
'a=rtcp-fb:102 nack pli\r\n' +
'a=fmtp:102 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f\r\n' +
'a=rtpmap:121 rtx/90000\r\n' +
'a=fmtp:121 apt=102\r\n' +
'a=rtpmap:127 H264/90000\r\n' +
'a=rtcp-fb:127 goog-remb\r\n' +
'a=rtcp-fb:127 transport-cc\r\n' +
'a=rtcp-fb:127 ccm fir\r\n' +
'a=rtcp-fb:127 nack\r\n' +
'a=rtcp-fb:127 nack pli\r\n' +
'a=fmtp:127 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42001f\r\n' +
'a=rtpmap:120 rtx/90000\r\n' +
'a=fmtp:120 apt=127\r\n' +
'a=rtpmap:125 H264/90000\r\n' +
'a=rtcp-fb:125 goog-remb\r\n' +
'a=rtcp-fb:125 transport-cc\r\n' +
'a=rtcp-fb:125 ccm fir\r\n' +
'a=rtcp-fb:125 nack\r\n' +
'a=rtcp-fb:125 nack pli\r\n' +
'a=fmtp:125 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f\r\n' +
'a=rtpmap:107 rtx/90000\r\n' +
'a=fmtp:107 apt=125\r\n' +
'a=rtpmap:108 H264/90000\r\n' +
'a=rtcp-fb:108 goog-remb\r\n' +
'a=rtcp-fb:108 transport-cc\r\n' +
'a=rtcp-fb:108 ccm fir\r\n' +
'a=rtcp-fb:108 nack\r\n' +
'a=rtcp-fb:108 nack pli\r\n' +
'a=fmtp:108 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42e01f\r\n' +
'a=rtpmap:109 rtx/90000\r\n' +
'a=fmtp:109 apt=108\r\n' +
'a=rtpmap:124 H264/90000\r\n' +
'a=rtcp-fb:124 goog-remb\r\n' +
'a=rtcp-fb:124 transport-cc\r\n' +
'a=rtcp-fb:124 ccm fir\r\n' +
'a=rtcp-fb:124 nack\r\n' +
'a=rtcp-fb:124 nack pli\r\n' +
'a=fmtp:124 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=4d001f\r\n' +
'a=rtpmap:119 rtx/90000\r\n' +
'a=fmtp:119 apt=124\r\n' +
'a=rtpmap:123 H264/90000\r\n' +
'a=rtcp-fb:123 goog-remb\r\n' +
'a=rtcp-fb:123 transport-cc\r\n' +
'a=rtcp-fb:123 ccm fir\r\n' +
'a=rtcp-fb:123 nack\r\n' +
'a=rtcp-fb:123 nack pli\r\n' +
'a=fmtp:123 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=64001f\r\n' +
'a=rtpmap:118 rtx/90000\r\n' +
'a=fmtp:118 apt=123\r\n' +
'a=rtpmap:114 red/90000\r\n' +
'a=rtpmap:115 rtx/90000\r\n' +
'a=fmtp:115 apt=114\r\n' +
'a=rtpmap:116 ulpfec/90000\r\n' +
'a=ssrc-group:FID 860428813 4198649496\r\n' +
'a=ssrc:860428813 cname:XuMK8Lp2rvft5uMI\r\n' +
'a=ssrc:860428813 msid:yLSrYTOKMcyDlIv8Sqhr5RW0DNPgo984JnC1 a0a25d11-697e-4b2d-bf43-60c9e59291d6\r\n' +
'a=ssrc:860428813 mslabel:yLSrYTOKMcyDlIv8Sqhr5RW0DNPgo984JnC1\r\n' +
'a=ssrc:860428813 label:a0a25d11-697e-4b2d-bf43-60c9e59291d6\r\n' +
'a=ssrc:4198649496 cname:XuMK8Lp2rvft5uMI\r\n' +
'a=ssrc:4198649496 msid:yLSrYTOKMcyDlIv8Sqhr5RW0DNPgo984JnC1 a0a25d11-697e-4b2d-bf43-60c9e59291d6\r\n' +
'a=ssrc:4198649496 mslabel:yLSrYTOKMcyDlIv8Sqhr5RW0DNPgo984JnC1\r\n' +
'a=ssrc:4198649496 label:a0a25d11-697e-4b2d-bf43-60c9e59291d6\r\n'
My Code Which Genrate this sdp
return new Promise((resolve, reject) => {
webRtcPeer = kurentoUtils.WebRtcPeer.WebRtcPeerSendrecv(options, function(
error) {
if (error) {
reject(error)
console.error(error);
setCallState(NO_CALL);
}
this.generateOffer(function(error, offerSdp) {
if (error) {
console.error(error);
setCallState(NO_CALL);
}
console.log(offerSdp)
var message = {
id: 'call',
from: LOCAL_USER_ID,
name: userObject.firstName + " " + userObject.lastName,
to: id,
sdpOffer: offerSdp
};
socket.emit('message', message)
});
});
})
}
My Whole Calling Method Maybe it Help
async function kurentoCall(id) {
if (typeof AdapterJS !== 'undefined' && AdapterJS.webrtcDetectedBrowser === 'IE' && AdapterJS.webrtcDetectedVersion >= 9) {
await navigator.getUserMedia(constraints, function(stream) {
local_video_stream = stream;
}, (err) => console.log(err));
} else {
await navigator.mediaDevices.getUserMedia(constraints).then(function(stream) {
console.log("video stream acquired")
local_video_stream = stream;
}).catch((err) => console.log(err));
}
if (!local_video_stream) {
console.log(local_video_stream)
console.log("No stream")
return;
}
var options = {
localVideo: videoInput,
remoteVideo: videoOutput,
videoStream: local_video_stream,
onicecandidate: onIceCandidate
}
return new Promise((resolve, reject) => {
webRtcPeer = kurentoUtils.WebRtcPeer.WebRtcPeerSendrecv(options, function(
error) {
if (error) {
reject(error)
console.error(error);
setCallState(NO_CALL);
}
this.generateOffer(function(error, offerSdp) {
if (error) {
console.error(error);
setCallState(NO_CALL);
}
console.log(offerSdp)
var message = {
id: 'call',
from: LOCAL_USER_ID,
name: userObject.firstName + " " + userObject.lastName,
to: id,
sdpOffer: offerSdp
};
socket.emit('message', message)
});
});
})
}
I changed the SDP bandwidth attribute when I went to create an answer:
function changeSDP( offer ) {
let audioBandwidth = 2000
let videoBandwidth = 2000
// splitting the sdp every line
let sdp = offer.split('\r\n');
let new_sdp = '';
let position = null;
sdp = sdp.slice(0, -1);
// looping over every line to identify where the bandwidth lines are
for(let i = 0; i < sdp.length; i++) {
if(sdp[i].match('b=AS:')) {
position = i;
}
}
if(position) {
sdp.splice(position, 1);
}
// looping over the truncated sdp to replace the bandwidth attributes
for(let i = 0; i < sdp.length; i++) {
// matching video bandwidth
if(sdp[i].match('m=video')) {
new_sdp += sdp[i] + '\r\n' + 'b=AS:' + videoBandwidth + '\r\n';
} else {
if(sdp[i].match('m=audio')) {
// current line is the audio bandwidth line, replace it
new_sdp += sdp[i] + '\r\n' + 'b=AS:' + audioBandwidth + '\r\n';
}
else {
// the sdp doesn't need to be changed, use the old sdp
new_sdp += sdp[i] + '\r\n';
}
}
}
// return the old sdp
return new_sdp;
}
ChangeSDP takes the answer's sdp and forces the SDP to use the parameters given.
Here is an (incomplete) example of how to use it:
answer = await pc.createAnswer();
answer.sdp = changeSDP( oldSDP )
await pc.setLocalDescription( answer );