Commit 32a68a5d authored by Dele Olajide's avatar Dele Olajide Committed by dele

Jitsi Videobridge plugin - removed config.js and enable configuration from...

Jitsi Videobridge plugin - removed config.js and enable configuration from openfire admin web console.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@14007 b35dd754-fafc-0310-a699-88a17e54d16e
parent 3aec383e
......@@ -883,7 +883,7 @@ function handleOffer (from, offer)
//console.log("bridgeSDP.raw", bridgeSDP.raw);
window.RTC.rayo.pc[videobridge] = new window.RTC.peerconnection(null, {'optional': [{'DtlsSrtpKeyAgreement': 'true'}, {googIPv6: config.useIPv6}]});
window.RTC.rayo.pc[videobridge] = new window.RTC.peerconnection(config.iceServers, {'optional': [{'DtlsSrtpKeyAgreement': 'true'}, {googIPv6: config.useIPv6}]});
window.RTC.rayo.pc[videobridge].onicecandidate = function(event)
......
plugin.title=Jitsi Videobridge
plugin.title.description=Jitsi Videobridge Settings
config.page.title=Jitsi Videobridge Settings Page
config.page.configuration.media.title=Configuration
config.page.configuration.media.title=Media Configuration
config.page.configuration.security.title=Security
config.page.configuration.recording.title=Recordings
config.page.configuration.telephone.title=SIP Registration
......@@ -22,3 +22,14 @@ config.page.configuration.outboundproxy=Outbound Proxy
config.page.configuration.save.title=Save Settings
config.page.configuration.submit=Save
config.page.configuration.restart.warning=Changes to any of these parameters requires a restart of Openfire.
config.page.configuration.ofmeet.title=OfMeet Configuration
config.page.configuration.ofmeet.useipv6.enabled=Enable IPv6
config.page.configuration.ofmeet.useipv6.enabled_desc=Enable webrtc to use IPv6
config.page.configuration.ofmeet.useipv6.disabled=Disable IPv6
config.page.configuration.ofmeet.useipv6.disabled_desc=Do not use IPv6 for webrtc
config.page.configuration.ofmeet.usenicks.enabled=Enable Nicknames
config.page.configuration.ofmeet.usenicks.enabled_desc=Prompt user to enter a nickname
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
config.page.configuration.ofmeet.resolution=Video Resolution
\ No newline at end of file
......@@ -88,10 +88,13 @@ public class MatroskaFileWriter
public void writeSegmentHeader()
{
MatroskaSegment segmentElem = (MatroskaSegment)doc.createElement(MatroskaDocType.Segment_Id);
//MatroskaSegment segmentElem = (MatroskaSegment)doc.createElement(MatroskaDocType.Segment_Id);
//segmentElem.setSize(-1);
segmentElem.setUnknownSize(true);
segmentElem.writeHeaderData(ioDW);
//segmentElem.setUnknownSize(false);
//segmentElem.writeHeaderData(ioDW);
MasterElement ebmlHeaderElem = (MasterElement)doc.createElement(MatroskaDocType.Segment_Id);
ebmlHeaderElem.writeElement(ioDW);
}
public void writeSegmentInfo()
......
package org.ifsoft.rtp;
public class ArrayExtensions
{
public ArrayExtensions()
{
}
public static Integer getLength(Object array[])
{
return Integer.valueOf(array.length);
}
public static Integer getLength(byte array[])
{
return Integer.valueOf(array.length);
}
}
package org.ifsoft.rtp;
import java.util.ArrayList;
import java.util.Iterator;
public class ByteCollection
{
private ArrayList arrayList;
public void add(byte b)
{
arrayList.add(Byte.valueOf(b));
}
public void add(int b)
{
arrayList.add(Byte.valueOf((byte)b));
}
public void addRange(byte buffer[])
{
byte arr$[] = buffer;
int len$ = arr$.length;
for(int i$ = 0; i$ < len$; i$++)
{
byte b = arr$[i$];
add(b);
}
}
public void addRange(ByteCollection collection)
{
byte b;
for(Iterator i$ = collection.getList().iterator(); i$.hasNext(); add(b))
b = ((Byte)i$.next()).byteValue();
}
public ByteCollection()
{
arrayList = new ArrayList();
}
public ByteCollection(byte buffer[])
{
arrayList = new ArrayList();
addRange(buffer);
}
public byte get(Integer index)
{
return ((Byte)arrayList.get(index.intValue())).byteValue();
}
public Integer getCount()
{
return Integer.valueOf(arrayList.size());
}
ArrayList getList()
{
return arrayList;
}
public byte[] getRange(Integer index, Integer count)
{
byte range[] = new byte[count.intValue()];
for(int i = 0; i < count.intValue(); i++)
range[i] = ((Byte)arrayList.get(index.intValue() + i)).byteValue();
return range;
}
public void insertRange(Integer index, byte buffer[])
{
for(int i = 0; i < buffer.length; i++)
arrayList.add(index.intValue() + i, Byte.valueOf(buffer[i]));
}
public void insertRange(Integer index, ByteCollection collection)
{
for(int i = 0; i < collection.getCount().intValue(); i++)
arrayList.add(index.intValue() + i, Byte.valueOf(collection.get(Integer.valueOf(i))));
}
public void removeRange(Integer index, Integer count)
{
removeRange(arrayList, index.intValue(), count.intValue());
}
public byte[] toArray()
{
byte array[] = new byte[arrayList.size()];
for(int i = 0; i < array.length; i++)
array[i] = ((Byte)arrayList.get(i)).byteValue();
return array;
}
public void removeRange(ArrayList array, int index, int count)
{
for(int i = 0; i < count; i++)
array.remove(index);
}
}
package org.ifsoft.rtp;
import java.util.ArrayList;
public class Vp8Accumulator
{
private ArrayList packets;
public void add(Vp8Packet packet)
{
if(packet.getStartOfPartition().booleanValue() || packets.size() > 0)
packets.add(packet);
}
public Vp8Packet[] getPackets()
{
return (Vp8Packet[])packets.toArray(new Vp8Packet[0]);
}
public void reset()
{
packets = new ArrayList();
}
public Vp8Accumulator()
{
packets = new ArrayList();
}
}
......@@ -43,16 +43,22 @@ public class Config extends HttpServlet
ServletOutputStream out = response.getOutputStream();
String iceServers = JiveGlobals.getProperty("org.jitsi.videobridge.ofmeet.iceservers", "");
String resolution = JiveGlobals.getProperty("org.jitsi.videobridge.ofmeet.resolution", "720");
String useNicks = JiveGlobals.getProperty("org.jitsi.videobridge.ofmeet.usenicks", "false");
String useIPv6 = JiveGlobals.getProperty("org.jitsi.videobridge.ofmeet.useipv6", "false");
out.println("var config = {");
out.println(" hosts: {");
out.println(" domain: '" + domain + "',");
out.println(" muc: 'conference." + domain + "',");
out.println(" bridge: 'jitsi-videobridge." + domain + "',");
out.println(" },");
out.println(" useIPv6: false,");
out.println(" useNicks: false,");
if (!iceServers.trim().equals("")) out.println(" iceServers: " + iceServers + ",");
out.println(" useIPv6: " + useIPv6 + ",");
out.println(" useNicks: " + useNicks + ",");
out.println(" useWebsockets: " + (websockets ? "true" : "false") + ",");
out.println(" resolution: '720',");
out.println(" resolution: '" + resolution + "',");
out.println(" bosh: window.location.protocol + '//' + window.location.host + '/http-bind/'");
out.println("}; ");
......
......@@ -73,6 +73,7 @@ import org.ifsoft.*;
import org.ifsoft.sip.*;
import net.sf.fmj.media.rtp.*;
import org.ifsoft.rtp.*;
/**
* Implements <tt>org.jivesoftware.openfire.container.Plugin</tt> to integrate
......@@ -1011,13 +1012,15 @@ public class PluginImpl implements Plugin, PropertyEventListener
*
*
*/
private JID user;
private byte partial[];
private int lastseqnum = -1;
private Vp8Accumulator _accumulator = new Vp8Accumulator();
private Integer _lastSequenceNumber = Integer.valueOf(-1);
private boolean _sequenceNumberingViolated = false;
private Participant me = this;
private int snapshot = 0;
private boolean isKeyframe = false;
private JID user;
/**
*
*
......@@ -1053,7 +1056,7 @@ public class PluginImpl implements Plugin, PropertyEventListener
*/
public void recordData(RawPacket packet)
{
if (snapshot < 1) Log.info("transferData " + packet.getPayloadLength() + " " + packet.getHeaderLength() + " " + packet.getExtensionLength());
//if (snapshot < 1) Log.info("transferData " + packet.getPayloadLength() + " " + packet.getHeaderLength() + " " + packet.getExtensionLength());
try {
......@@ -1061,96 +1064,40 @@ public class PluginImpl implements Plugin, PropertyEventListener
{
byte[] rtp = packet.getPayload();
if (rtp.length < 2) return; //bad packet
int vp8Length = packet.getPayloadLength();
int payloadOffset = 0;
if (partial == null) {
partial = new byte[0];
}
if (snapshot < 1) Log.info("expecting X R N S PartID");
byte x = rtp[payloadOffset]; //X R N S PartID
payloadOffset++;
vp8Length--;
if ((x & 0x80) != 0) // extened bits
{
if (snapshot < 1) Log.info("found I L T RSV-A");
byte ilt = rtp[payloadOffset]; //I L T RSV-A
payloadOffset++;
vp8Length--;
if ((ilt & 0x80) != 0) { //picture ID
byte m = rtp[payloadOffset]; //picture ID
if (snapshot < 1) Log.info("found picture ID 1");
payloadOffset++;
vp8Length--;
if(!_sequenceNumberingViolated && _lastSequenceNumber.intValue() > -1 && Vp8Packet.getSequenceNumberDelta(packet.getSequenceNumber(), _lastSequenceNumber).intValue() > 1)
_sequenceNumberingViolated = true;
if ((m & 0x80) != 0)
{
if (snapshot < 1) Log.info("found picture ID 2");
payloadOffset++;
vp8Length--;
}
}
_lastSequenceNumber = packet.getSequenceNumber();
Vp8Packet packet2 = Vp8Packet.parseBytes(rtp);
if ((ilt & 0x40) != 0) { //TL0PICIDX
if (snapshot < 1) Log.info("found TL0PICIDX");
payloadOffset++;
vp8Length--;
}
if(packet2 == null) return;
if ((ilt & 0x20) != 0 || (ilt & 0x10) != 0) { //TID RSV-B
if (snapshot < 1) Log.info("found TID RSV-B or keyframe index");
payloadOffset++;
vp8Length--;
}
}
_accumulator.add(packet2);
byte encodedFrame[] = null;
if ((x & 0x10) != 0 && (x & 0x0f) == 0 && vp8Length >= 3) // start of partition
if (packet.isPacketMarked())
{
if (snapshot < 1) Log.info("found start of partition " + x);
partial = new byte[0];
isKeyframe = (rtp[payloadOffset] & 0x1) == 0;
}
int partialLength = partial.length;
partial = Arrays.copyOf(partial, partial.length + vp8Length);
System.arraycopy(rtp, payloadOffset, partial, partialLength, vp8Length);
encodedFrame = Vp8Packet.depacketize(_accumulator.getPackets());
boolean isKeyframe = encodedFrame != null && encodedFrame.length > 0 && (encodedFrame[0] & 1) == 0;
int thisseqnum = packet.getSequenceNumber();
if(_sequenceNumberingViolated && isKeyframe)
_sequenceNumberingViolated = false;
if (lastseqnum != -1 && thisseqnum != lastseqnum + 1) {
if (snapshot < 1) Log.info("VP8:Received packet out of order, discarding frame.");
partial = null;
lastseqnum = -1;
return;
}
lastseqnum = thisseqnum;
_accumulator.reset();
if (packet.isPacketMarked())
{
if (recorder != null && partial != null)
if (recorder != null && encodedFrame != null && _sequenceNumberingViolated == false)
{
byte[] full = Arrays.copyOf(partial, partial.length);
if (snapshot < 1) Log.info("recordData " + " " + packet.getPayloadType() + " " + full + " " + packet.getSequenceNumber() + " " + isKeyframe);
byte[] full = Arrays.copyOf(encodedFrame, encodedFrame.length);
recorder.write(full, 0, full.length, isKeyframe, packet.getTimestamp());
if (isKeyframe && snapshot < 1)
{
Log.info("recordData " + " " + packet.getPayloadType() + " " + full + " " + packet.getSequenceNumber() + " " + packet.getTimestamp());
recorder.writeWebPImage(full, 0, full.length, packet.getTimestamp());
snapshot++;
}
}
partial = null;
lastseqnum = -1;
}
} else {
Log.error("record video cannot parse packet data " + packet);
......@@ -1168,7 +1115,7 @@ public class PluginImpl implements Plugin, PropertyEventListener
this.nickname = nickname;
this.user = user;
this.focusName = focusName;
this.sequenceNumberingViolated = Boolean.valueOf(false);
this.sequenceNumberingViolated = false;
this.lastSequenceNumber = Integer.valueOf(-1);
}
/**
......
......@@ -122,7 +122,7 @@ public class Recorder extends Thread
MatroskaFileTrack track = new MatroskaFileTrack();
track.TrackNo = (short)1;
track.TrackUID = new java.util.Random().nextLong();
track.TrackUID = (long)1;
track.TrackType = MatroskaDocType.track_video;
track.Name = "VP8";
track.CodecName = "VP8";
......
......@@ -83,6 +83,19 @@
String outboundproxy = request.getParameter("outboundproxy");
JiveGlobals.setProperty("voicebridge.default.proxy.outboundproxy", outboundproxy);
String iceServers = request.getParameter("iceservers");
JiveGlobals.setProperty("org.jitsi.videobridge.ofmeet.iceservers", iceServers);
String useIPv6 = request.getParameter("useipv6");
JiveGlobals.setProperty("org.jitsi.videobridge.ofmeet.useipv6", useIPv6);
String useNicks = request.getParameter("usenicks");
JiveGlobals.setProperty("org.jitsi.videobridge.ofmeet.usenicks", useNicks);
String resolution = request.getParameter("resolution");
JiveGlobals.setProperty("org.jitsi.videobridge.ofmeet.resolution", resolution);
}
%>
......@@ -102,6 +115,58 @@
<div class="jive-table">
<form action="jitsi-videobridge.jsp" method="post">
<p>
<table class="jive-table" cellpadding="0" cellspacing="0" border="0" width="50%">
<thead>
<tr>
<th colspan="2"><fmt:message key="config.page.configuration.ofmeet.title"/></th>
</tr>
</thead>
<tbody>
<tr>
<td nowrap colspan="2">
<input type="radio" value="false" name="useipv6" <%= ("false".equals(JiveGlobals.getProperty("org.jitsi.videobridge.ofmeet.useipv6", "false")) ? "checked" : "") %>>
<b><fmt:message key="config.page.configuration.ofmeet.useipv6.disabled" /></b> - <fmt:message key="config.page.configuration.ofmeet.useipv6.disabled_desc" />
</td>
</tr>
<tr>
<td nowrap colspan="2">
<input type="radio" value="true" name="useipv6" <%= ("true".equals(JiveGlobals.getProperty("org.jitsi.videobridge.ofmeet.useipv6", "false")) ? "checked" : "") %>>
<b><fmt:message key="config.page.configuration.ofmeet.useipv6.enabled" /></b> - <fmt:message key="config.page.configuration.ofmeet.useipv6.enabled_desc" />
</td>
</tr>
<tr>
<td nowrap colspan="2">
<input type="radio" value="false" name="usenicks" <%= ("false".equals(JiveGlobals.getProperty("org.jitsi.videobridge.ofmeet.usenicks", "false")) ? "checked" : "") %>>
<b><fmt:message key="config.page.configuration.ofmeet.usenicks.disabled" /></b> - <fmt:message key="config.page.configuration.ofmeet.usenicks.disabled_desc" />
</td>
</tr>
<tr>
<td nowrap colspan="2">
<input type="radio" value="true" name="usenicks" <%= ("true".equals(JiveGlobals.getProperty("org.jitsi.videobridge.ofmeet.usenicks", "false")) ? "checked" : "") %>>
<b><fmt:message key="config.page.configuration.ofmeet.usenicks.enabled" /></b> - <fmt:message key="config.page.configuration.ofmeet.usenicks.enabled_desc" />
</td>
</tr>
<tr>
<td align="left" width="150">
<fmt:message key="config.page.configuration.ofmeet.iceservers"/>
</td>
<td><input type="text" size="50" maxlength="100" name="iceservers"
value="<%= JiveGlobals.getProperty("org.jitsi.videobridge.ofmeet.iceservers", "") %>">
</td>
</tr>
<tr>
<td align="left" width="150">
<fmt:message key="config.page.configuration.ofmeet.resolution"/>
</td>
<td><input type="text" size="10" maxlength="100" name="resolution"
value="<%= JiveGlobals.getProperty("org.jitsi.videobridge.ofmeet.resolution", "720") %>">
</td>
</tr>
</tbody>
</table>
</p>
<p>
<table class="jive-table" cellpadding="0" cellspacing="0" border="0" width="50%">
<thead>
<tr>
......@@ -127,7 +192,8 @@
</tr>
</tbody>
</table>
<p/>
</p>
<p>
<table class="jive-table" cellpadding="0" cellspacing="0" border="0" width="50%">
<thead>
<tr>
......@@ -153,7 +219,8 @@
</tr>
</tbody>
</table>
<p/>
</p>
<p>
<table class="jive-table" cellpadding="0" cellspacing="0" border="0" width="50%">
<thead>
<tr>
......@@ -175,7 +242,8 @@
</tr>
</tbody>
</table>
<p/>
</p>
<p>
<table class="jive-table" cellpadding="0" cellspacing="0" border="0" width="50%">
<thead>
<tr>
......@@ -220,7 +288,8 @@
</td>
</tr>
</table>
<p/>
</p>
<p>
<table class="jive-table" cellpadding="0" cellspacing="0" border="0" width="50%">
<thead>
<tr>
......@@ -233,6 +302,7 @@
</tr>
</tbody>
</table>
</p>
</form>
</div>
......
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