Commit b5e771e9 authored by Dele Olajide's avatar Dele Olajide Committed by dele

Jitsi Videobridge - Fixed broken screen share

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@14005 b35dd754-fafc-0310-a699-88a17e54d16e
parent 93daa5f9
......@@ -10,7 +10,8 @@
<script src="js/base64.js"></script>
<script src="js/strophe.js"></script>
<script src="js/muc.js"></script>
<script src="js/webrtc.sdp.js"></script>
<script src="js/strophe.jingle.sdp.js"></script>
<script src="js/strophe.jingle.sdp.util.js"></script>
<script src="js/strophe-openfire.js"></script>
<script src="js/main.js"></script>
<script src="js/util.js"></script>
......
......@@ -4,6 +4,7 @@ var nickname = null;
var roomUrl = null;
var sharedKey = '';
var screenShare = false;
var screenToVideo = false;
var pdfShare = null;
var pdfFrame = null;
var pdfPage = "1";
......@@ -129,7 +130,7 @@ $(document).ready(function ()
getConstraints(['audio', 'video'], config.resolution);
$("#screen").removeClass("fa-border");
}
//showToolbar();
showToolbar();
updateRoomUrl(window.location.href);
getUserMedia();
......@@ -399,6 +400,7 @@ function getConstraints(um, resolution, bandwidth, fps)
if (um.indexOf('audio') >= 0) {
window.RTC.rayo.constraints.audio = {};// same behaviour as true
}
if (um.indexOf('screen') >= 0) {
window.RTC.rayo.constraints.video = {
"mandatory": {
......@@ -408,7 +410,8 @@ function getConstraints(um, resolution, bandwidth, fps)
"maxFrameRate": "3"
}
};
}
} else
if (resolution && window.RTC.rayo.constraints.video)
{
......@@ -542,10 +545,11 @@ function resizeLarge()
function getAvailableVideoWidth()
{
var chatspaceWidth = $('#chatspace').is(":visible") ? $('#chatspace').width() : 0;
var chatspaceWidth = $('#chatspace').css("opacity") == 1 ? $('#chatspace').width() : 0;
return window.innerWidth - chatspaceWidth;
};
function resizeThumbnails()
{
// Calculate the available height, which is the inner window height minus
......@@ -655,14 +659,13 @@ function doJoin() {
$('#nickname').css({visibility:"hidden"});
$('#ofmeet').css({visibility:'visible'});
$('#usermsg').css({visibility:'visible'});
openChat();
}
}
function rayoCallback(presence)
{
console.log("rayoCallback", presence);
console.log("rayoCallback start", presence);
var from = $(presence).attr('from');
......@@ -692,6 +695,8 @@ function rayoCallback(presence)
$("#invite").removeClass("fa-spin");
});
console.log("rayoCallback end", presence);
return true;
};
......@@ -707,31 +712,32 @@ function removeSSRC(from, removesource)
$(removesource).find('content').each(function()
{
var name = $(this).attr('name');
var name = $(this).attr('name');
var ssrc = null;
$(this).find('source').each(function()
{
{
ssrc = $(this).attr('ssrc');
});
if (ssrc != null)
{
var idx = (name == "audio" ? 0 : 1);
sdp.removeMediaLines(idx, 'a=ssrc:' + ssrc);
{
var idx = (name == "audio" ? 0 : 1);
if (!screenToVideo) sdp.removeMediaLines(idx, 'a=ssrc:' + ssrc);
}
});
});
sdp.raw = sdp.session + sdp.media.join('');
//console.log("removeSSRC modified SDP", sdp.raw);
window.RTC.rayo.pc[videobridge].setRemoteDescription(new RTCSessionDescription({type: 'offer', sdp: sdp.raw}
), function() {
), function() {
console.log('removeSSRC modify ok');
}, function(error) {
console.log('removeSSRC modify failed');
});
};
......@@ -791,9 +797,9 @@ function handleOffer (from, offer)
{
console.log("handleOffer", offer);
//var bridgeSDP = new SDP('v=0\r\no=- 5151055458874951233 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\nm=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=sendrecv\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\nm=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=sendrecv\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\na=rtpmap:116 red/90000\r\na=rtpmap:117 ulpfec/90000\r\n');
//var bridgeSDP = new SDP('v=0\r\no=- 5151055458874951233 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\nm=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=sendrecv\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\nm=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=sendrecv\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\na=rtpmap:116 red/90000\r\na=rtpmap:117 ulpfec/90000\r\n');
var bridgeSDP = new SDP('v=0\r\no=- 5151055458874951233 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\nm=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=sendrecv\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\nm=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=sendrecv\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 muc = $(offer).attr('muc');
var nick = $(offer).attr('nickname');
var participant = $(offer).attr('participant');
......@@ -1041,13 +1047,22 @@ function registerRayoEvents()
);
}
function unregisterRayoEvents()
{
window.RTC.rayo.localStream.stop();
function unregisterRayoEvents(constraints, resolution)
{
connection.sendIQ($iq({to: connection.domain, type: 'set'}).c('colibri', {xmlns: 'urn:xmpp:rayo:colibri:1', action: 'expire', muc: roomjid}),
function (res) {
console.log('rayo colibri unregister set ok');
window.RTC.rayo.localStream.stop();
if (constraints)
{
setTimeout(function()
{
screenToVideo = false;
getConstraints(constraints, resolution);
getUserMedia();
}, 1000);
}
},
function (err) {
......@@ -1064,16 +1079,14 @@ function toggleScreenShare()
if (screenShare)
{
var screenDIV = document.getElementById("screenshare");
screenDIV.parentElement.removeChild(screenDIV);
screenToVideo = true;
unregisterRayoEvents(['audio', 'video'], config.resolution);
$("#screen").removeClass("fa-border");
} else {
var url = "publish.html?r=" + videobridge + "&screen=true";
$("body").append("<div id='screenshare'><iframe style='display:none' src='" + url + "'></iframe></div>");
unregisterRayoEvents(['screen']);
$("#screen").addClass("fa-border");
}
}
screenShare = !screenShare;
}
......@@ -1315,6 +1328,9 @@ function openChat() {
videospace.animate({right:chatspaceWidth, width:"80%"}, "slow");
}
resizeLarge();
positionLarge();
// Request the focus in the nickname field or the chat input field.
if ($('#nickinput').is(':visible'))
$('#nickinput').focus();
......@@ -1339,7 +1355,7 @@ function hideToolbar()
$('#header').hide("slide", { direction: "up", duration: 300});
}
else {
toolbarTimeout = setTimeout(hideToolbar, 2000);
toolbarTimeout = setTimeout(hideToolbar, 5000);
}
};
......@@ -1353,7 +1369,7 @@ function showToolbar()
clearTimeout(toolbarTimeout);
toolbarTimeout = null;
}
toolbarTimeout = setTimeout(hideToolbar, 2000);
toolbarTimeout = setTimeout(hideToolbar, 5000);
}
}
......@@ -1373,7 +1389,7 @@ function dockToolbar(isDock) {
showToolbar();
}
else {
toolbarTimeout = setTimeout(hideToolbar, 2000);
toolbarTimeout = setTimeout(hideToolbar, 5000);
}
}
}
......
<html>
<head>
<title>Openfire Meet</title>
<script src="js/jquery.min.js"></script>
<script src="js/md5.js"></script>
<script src="js/base64.js"></script>
<script src="js/strophe.js"></script>
<script src="js/muc.js"></script>
<script src="js/config.js"></script>
<script src="js/webrtc.sdp.js"></script>
<script src="js/strophe-openfire.js"></script>
<script src="js/publish.js"></script>
<link rel="shortcut icon" href="favicon.ico"/>
</head>
<body>
</body>
</html>
......@@ -255,7 +255,7 @@ public class PluginImpl implements Plugin, PropertyEventListener
if (username != null && "".equals(username) == false)
{
context.setSecurityHandler(basicAuth(username, password, "Private!"));
context.setSecurityHandler(basicAuth(username, password, "Videobridge"));
}
createIQHandlers();
......@@ -350,7 +350,7 @@ public class PluginImpl implements Plugin, PropertyEventListener
ConstraintSecurityHandler csh = new ConstraintSecurityHandler();
csh.setAuthenticator(new BasicAuthenticator());
csh.setRealmName("myrealm");
csh.setRealmName(realm);
csh.addConstraintMapping(cm);
csh.setLoginService(l);
......@@ -1017,6 +1017,7 @@ public class PluginImpl implements Plugin, PropertyEventListener
private int lastseqnum = -1;
private Participant me = this;
private int snapshot = 0;
private boolean isKeyframe = false;
/**
*
*
......@@ -1052,7 +1053,7 @@ public class PluginImpl implements Plugin, PropertyEventListener
*/
public void recordData(RawPacket packet)
{
if (snapshot < 10) Log.info("transferData " + packet.getPayloadLength() + " " + packet.getHeaderLength() + " " + packet.getExtensionLength());
if (snapshot < 1) Log.info("transferData " + packet.getPayloadLength() + " " + packet.getHeaderLength() + " " + packet.getExtensionLength());
try {
......@@ -1069,7 +1070,7 @@ public class PluginImpl implements Plugin, PropertyEventListener
partial = new byte[0];
}
if (snapshot < 10) Log.info("expecting X R N S PartID");
if (snapshot < 1) Log.info("expecting X R N S PartID");
byte x = rtp[payloadOffset]; //X R N S PartID
......@@ -1078,34 +1079,34 @@ public class PluginImpl implements Plugin, PropertyEventListener
if ((x & 0x80) != 0) // extened bits
{
if (snapshot < 10) Log.info("found I L T RSV-A");
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
if (snapshot < 10) Log.info("found picture ID 1");
byte m = rtp[payloadOffset]; //picture ID
if (snapshot < 1) Log.info("found picture ID 1");
payloadOffset++;
vp8Length--;
byte m = rtp[payloadOffset]; //picture ID
if ((m & 0x80) != 0)
{
if (snapshot < 10) Log.info("found picture ID 2");
if (snapshot < 1) Log.info("found picture ID 2");
payloadOffset++;
vp8Length--;
}
}
if ((ilt & 0x40) != 0) { //TL0PICIDX
if (snapshot < 10) Log.info("found TL0PICIDX");
if (snapshot < 1) Log.info("found TL0PICIDX");
payloadOffset++;
vp8Length--;
}
if ((ilt & 0x20) != 0 || (ilt & 0x10) != 0) { //TID RSV-B
if (snapshot < 10) Log.info("found TID RSV-B or keyframe index");
if (snapshot < 1) Log.info("found TID RSV-B or keyframe index");
payloadOffset++;
vp8Length--;
}
......@@ -1113,12 +1114,11 @@ public class PluginImpl implements Plugin, PropertyEventListener
if ((x & 0x10) != 0 && (x & 0x0f) == 0 && vp8Length >= 3) // start of partition
{
if (snapshot < 10) Log.info("found start of partition " + x);
if (snapshot < 1) Log.info("found start of partition " + x);
partial = new byte[0];
isKeyframe = (rtp[payloadOffset] & 0x1) == 0;
}
boolean isKeyframe = (rtp[payloadOffset] & 0x1) == 0;
int partialLength = partial.length;
partial = Arrays.copyOf(partial, partial.length + vp8Length);
System.arraycopy(rtp, payloadOffset, partial, partialLength, vp8Length);
......@@ -1126,7 +1126,7 @@ public class PluginImpl implements Plugin, PropertyEventListener
int thisseqnum = packet.getSequenceNumber();
if (lastseqnum != -1 && thisseqnum != lastseqnum + 1) {
if (snapshot < 10) Log.info("VP8:Received packet out of order, discarding frame.");
if (snapshot < 1) Log.info("VP8:Received packet out of order, discarding frame.");
partial = null;
lastseqnum = -1;
return;
......@@ -1138,19 +1138,19 @@ public class PluginImpl implements Plugin, PropertyEventListener
if (recorder != null && partial != null)
{
byte[] full = Arrays.copyOf(partial, partial.length);
if (snapshot < 10) Log.info("recordData " + " " + packet.getPayloadType() + " " + full + " " + packet.getSequenceNumber() + " " + isKeyframe);
if (snapshot < 1) Log.info("recordData " + " " + packet.getPayloadType() + " " + full + " " + packet.getSequenceNumber() + " " + isKeyframe);
recorder.write(full, 0, full.length, isKeyframe, packet.getTimestamp());
if (isKeyframe && snapshot < 10)
if (isKeyframe && snapshot < 1)
{
recorder.writeWebPImage(full, 0, full.length, packet.getTimestamp());
snapshot++;
}
}
partial = null;
lastseqnum = -1;
partial = null;
lastseqnum = -1;
}
} else {
Log.error("record video cannot parse packet data " + packet);
......@@ -1397,7 +1397,7 @@ public class PluginImpl implements Plugin, PropertyEventListener
if (videoChannel != null)
{
// webm file creation not working yet
//participant.addMediaStream(videoChannel.getMediaStream());
participant.addMediaStream(videoChannel.getMediaStream());
}
}
}
......@@ -1456,10 +1456,10 @@ public class PluginImpl implements Plugin, PropertyEventListener
}
Element audioContent = conferenceIq.addElement("content").addAttribute("name", "audio");
audioContent.addElement("channel").addAttribute("initiator", "true").addAttribute("expire", "15").addAttribute("rtp-level-relay-type", "mixer");
audioContent.addElement("channel").addAttribute("initiator", "true").addAttribute("expire", "15").addAttribute("rtp-level-relay-type", "mixer").addAttribute("endpoint", nickname);
Element videoContent = conferenceIq.addElement("content").addAttribute("name", "video");
videoContent.addElement("channel").addAttribute("initiator", "true").addAttribute("expire", "15");
videoContent.addElement("channel").addAttribute("initiator", "true").addAttribute("expire", "15").addAttribute("endpoint", nickname);
router.route(iq);
}
......
......@@ -130,7 +130,7 @@ public class Recorder extends Thread
track.CodecID = "V_VP8";
track.DefaultDuration = 0;
track.Video_PixelWidth = 640;
track.Video_PixelHeight = 360;
track.Video_PixelHeight = 480;
track.CodecPrivate = new byte[0];
mFW.TrackList.add(track);
......@@ -433,11 +433,11 @@ public class Recorder extends Thread
{
if (lastTimecode != 0)
{
//Log.info("writeData end cluster " + d.data);
Log.info("writeData end cluster " + d.data);
duration = d.timestamp - lastTimecode;
mFW.endCluster();
}
//Log.info("writeData start cluster " + d.timestamp);
Log.info("writeData start cluster " + d.timestamp);
mFW.startCluster(d.timestamp);
}
......
......@@ -140,7 +140,7 @@
</td>
<td align="left">
<input name="username" type="text" maxlength="16" size="16"
value="<%=JiveGlobals.getProperty(PluginImpl.USERNAME_PROPERTY_NAME, "jitsi")%>"/>
value="<%=JiveGlobals.getProperty(PluginImpl.USERNAME_PROPERTY_NAME, "")%>"/>
</td>
</tr>
<tr>
......@@ -148,7 +148,7 @@
</td>
<td align="left">
<input name="password" type="password" maxlength="16" size="16"
value="<%=JiveGlobals.getProperty(PluginImpl.PASSWORD_PROPERTY_NAME, "jitsi")%>"/>
value="<%=JiveGlobals.getProperty(PluginImpl.PASSWORD_PROPERTY_NAME, "")%>"/>
</td>
</tr>
</tbody>
......
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