Commit e97a1ff1 authored by Dele Olajide's avatar Dele Olajide

Jitsi Videobridge: Added bandwith control

parent 849bdd48
......@@ -875,7 +875,7 @@ function handleAddSSRC(from, addsource)
$(document).trigger('remoteaudiostreamadded.rayo', [{stream:{id:channelId}}, window.RTC.rayo.nickname]);
} else {
sdp.raw = sdp.session + sdp.media.join('');
sdp.raw = setBandwidth(sdp.session + sdp.media.join(''));
window.RTC.rayo.addssrc = true;
window.RTC.rayo.pc[videobridge].setRemoteDescription(new RTCSessionDescription({type: 'offer', sdp: sdp.raw}
......@@ -889,6 +889,12 @@ function handleAddSSRC(from, addsource)
}
};
function setBandwidth(sdp)
{
sdp = sdp.replace(/a=mid:audio\r\n/g, 'a=mid:audio\r\nb=AS:' + config.audioBandwidth + '\r\n');
sdp = sdp.replace(/a=mid:video\r\n/g, 'a=mid:video\r\nb=AS:' + config.videoBandwidth + '\r\n');
return sdp;
}
function handleOffer (from, offer)
{
......@@ -908,8 +914,8 @@ function handleOffer (from, offer)
}
var SDPHeader = "v=0\r\no=- 5151055458874951233 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n";
var SDPVideo = "m=video 1 RTP/SAVPF 100 116 117\r\nc=IN IP4 0.0.0.0\r\na=rtcp:1 IN IP4 0.0.0.0\r\na=mid:video\r\na=extmap:2 urn:ietf:params:rtp-hdrext:toffset\r\na=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=" + videoDirection + "\r\na=rtpmap:100 VP8/90000\r\na=rtcp-fb:100 ccm fir\r\na=rtcp-fb:100 nack\r\na=rtcp-fb:100 goog-remb\r\n";
var SDPAudio = "m=audio 1 RTP/SAVPF 111 0 126\r\nc=IN IP4 0.0.0.0\r\na=rtcp:1 IN IP4 0.0.0.0\r\na=mid:audio\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=" + audioDirection + "\r\na=rtpmap:111 opus/48000/2\r\na=fmtp:111 minptime=10\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:126 telephone-event/8000\r\na=maxptime:60\r\n";
var SDPVideo = "m=video 1 RTP/SAVPF 100 116 117\r\nc=IN IP4 0.0.0.0\r\na=rtcp:1 IN IP4 0.0.0.0\r\na=mid:video\r\nb=AS:" + config.videoBandwidth + "\r\na=extmap:2 urn:ietf:params:rtp-hdrext:toffset\r\na=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=" + videoDirection + "\r\na=rtpmap:100 VP8/90000\r\na=rtcp-fb:100 ccm fir\r\na=rtcp-fb:100 nack\r\na=rtcp-fb:100 goog-remb\r\n";
var SDPAudio = "m=audio 1 RTP/SAVPF 111 0 126\r\nc=IN IP4 0.0.0.0\r\na=rtcp:1 IN IP4 0.0.0.0\r\na=mid:audio\r\nb=AS:" + config.audioBandwidth + "\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=" + audioDirection + "\r\na=rtpmap:111 opus/48000/2\r\na=fmtp:111 minptime=10\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:126 telephone-event/8000\r\na=maxptime:60\r\n";
if (!config.recordVideo)
......
......@@ -39,4 +39,6 @@ config.page.configuration.ofmeet.usenicks.enabled_desc=Prompt user to enter a ni
config.page.configuration.ofmeet.usenicks.disabled=Disable Nicknames
config.page.configuration.ofmeet.usenicks.disabled_desc=Do not prompt user to provide a nickname
config.page.configuration.ofmeet.iceservers=ICE Servers (JSON object of STUN and TURN servers)
config.page.configuration.ofmeet.resolution=Video Resolution
\ No newline at end of file
config.page.configuration.ofmeet.resolution=Video Resolution
config.page.configuration.ofmeet.audio.bandwidth=Audio Bandwidth
config.page.configuration.ofmeet.video.bandwidth=Video Bandwidth
\ No newline at end of file
......@@ -46,6 +46,8 @@ public class Config extends HttpServlet
String iceServers = JiveGlobals.getProperty("org.jitsi.videobridge.ofmeet.iceservers", "");
String resolution = JiveGlobals.getProperty("org.jitsi.videobridge.ofmeet.resolution", "720");
String audioBandwidth = JiveGlobals.getProperty("org.jitsi.videobridge.ofmeet.audio.bandwidth", "64");
String videoBandwidth = JiveGlobals.getProperty("org.jitsi.videobridge.ofmeet.video.bandwidth", "512");
String useNicks = JiveGlobals.getProperty("org.jitsi.videobridge.ofmeet.usenicks", "false");
String useIPv6 = JiveGlobals.getProperty("org.jitsi.videobridge.ofmeet.useipv6", "false");
String recordVideo = JiveGlobals.getProperty("org.jitsi.videobridge.media.record", "true");
......@@ -63,6 +65,8 @@ public class Config extends HttpServlet
out.println(" useWebsockets: " + (websockets ? "true" : "false") + ",");
out.println(" useNodeJs: " + (nodejs ? "true" : "false") + ",");
out.println(" resolution: '" + resolution + "',");
out.println(" audioBandwidth: '" + audioBandwidth + "',");
out.println(" videoBandwidth: '" + videoBandwidth + "',");
out.println(" bosh: window.location.protocol + '//' + window.location.host + '/http-bind/'");
out.println("}; ");
......
......@@ -104,7 +104,12 @@
String resolution = request.getParameter("resolution");
JiveGlobals.setProperty("org.jitsi.videobridge.ofmeet.resolution", resolution);
String audiobandwidth = request.getParameter("audiobandwidth");
JiveGlobals.setProperty("org.jitsi.videobridge.ofmeet.audio.bandwidth", audiobandwidth);
String videobandwidth = request.getParameter("videobandwidth");
JiveGlobals.setProperty("org.jitsi.videobridge.ofmeet.video.bandwidth", videobandwidth);
}
%>
......@@ -171,6 +176,22 @@
<td><input type="text" size="10" maxlength="100" name="resolution"
value="<%= JiveGlobals.getProperty("org.jitsi.videobridge.ofmeet.resolution", "720") %>">
</td>
</tr>
<tr>
<td align="left" width="150">
<fmt:message key="config.page.configuration.ofmeet.audio.bandwidth"/>
</td>
<td><input type="text" size="10" maxlength="100" name="audiobandwidth"
value="<%= JiveGlobals.getProperty("org.jitsi.videobridge.ofmeet.audio.bandwidth", "64") %>">
</td>
</tr>
<tr>
<td align="left" width="150">
<fmt:message key="config.page.configuration.ofmeet.video.bandwidth"/>
</td>
<td><input type="text" size="10" maxlength="100" name="videobandwidth"
value="<%= JiveGlobals.getProperty("org.jitsi.videobridge.ofmeet.video.bandwidth", "512") %>">
</td>
</tr>
</tbody>
</table>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment