Skip to content

Commit

Permalink
Merge branch 'master' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaustav Das Modak committed Apr 23, 2015
2 parents 7cf888f + da31587 commit 620ffbd
Show file tree
Hide file tree
Showing 10 changed files with 173 additions and 47 deletions.
50 changes: 38 additions & 12 deletions erizo/src/erizo/SdpInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ namespace erizo {
if (isFingerprint) {
sdp << "a=fingerprint:sha-256 "<< fingerprint << endl;
}
switch (this->direction){
switch (this->audioDirection){
case SENDONLY:
sdp << "a=sendonly" << endl;
break;
Expand Down Expand Up @@ -409,7 +409,7 @@ namespace erizo {
if (isFingerprint) {
sdp << "a=fingerprint:sha-256 "<< fingerprint << endl;
}
switch (this->direction){
switch (this->videoDirection){
case SENDONLY:
sdp << "a=sendonly" << endl;
break;
Expand Down Expand Up @@ -522,18 +522,32 @@ namespace erizo {
this->hasVideo = offerSdp.hasVideo;
this->hasAudio = offerSdp.hasAudio;
this->bundleTags = offerSdp.bundleTags;
switch(offerSdp.direction){
switch(offerSdp.videoDirection){
case SENDONLY:
this->direction = RECVONLY;
this->videoDirection = RECVONLY;
break;
case RECVONLY:
this->direction = SENDONLY;
this->videoDirection = SENDONLY;
break;
case SENDRECV:
this->direction = SENDRECV;
this->videoDirection = SENDRECV;
break;
default:
this->direction = SENDRECV;
this->videoDirection = SENDRECV;
break;
}
switch(offerSdp.audioDirection){
case SENDONLY:
this->audioDirection = RECVONLY;
break;
case RECVONLY:
this->audioDirection = SENDONLY;
break;
case SENDRECV:
this->audioDirection = SENDRECV;
break;
default:
this->audioDirection = SENDRECV;
break;
}
if (offerSdp.videoRtxSsrc != 0){
Expand Down Expand Up @@ -586,13 +600,25 @@ namespace erizo {
// At this point we support only one direction per SDP
// Any other combination does not make sense at this point in Licode
if (isRecvOnly != std::string::npos){
ELOG_DEBUG("RecvOnly sdp")
this->direction = RECVONLY;
ELOG_DEBUG("RecvOnly sdp")
if (mtype == AUDIO_TYPE){
this->audioDirection = RECVONLY;
}else{
this->videoDirection = RECVONLY;
}
}else if(isSendOnly != std::string::npos){
this->direction = SENDONLY;
ELOG_DEBUG("SendOnly sdp")
ELOG_DEBUG("SendOnly sdp")
if (mtype == AUDIO_TYPE){
this->audioDirection = SENDONLY;
}else{
this->videoDirection = SENDONLY;
}
}else if (isSendRecv != std::string::npos){
this->direction = SENDRECV;
if (mtype == AUDIO_TYPE){
this->audioDirection = SENDRECV;
}else{
this->videoDirection = SENDRECV;
}
ELOG_DEBUG("SendRecv sdp")
}

Expand Down
2 changes: 1 addition & 1 deletion erizo/src/erizo/SdpInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ class SdpInfo {
*/
bool isRtcpMux;

StreamDirection direction;
StreamDirection videoDirection, audioDirection;
/**
* RTP Profile type
*/
Expand Down
13 changes: 13 additions & 0 deletions erizo_controller/erizoClient/extras/firefox-extension/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Instructions to create your own Firefox Screensharing Extension:

1. Modify bootstrap.js file, updating the variable domainsUsed with your own domains.

2. Modify install.rdf with your own extension information

3. Choose your icon (48x48) and name it icon.png

4. Run createExtension.sh script to create your .xpi containing the three files.

5. Install the .xpi file in Firefox

6. Enjoy Firefox Screensharing with Licode!
40 changes: 40 additions & 0 deletions erizo_controller/erizoClient/extras/firefox-extension/bootstrap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
* The source code can be found here: HenrikJoreteg/getScreenMedia/firefox-extension-sample
*/

var domainsUsed = ["*.dit.upm.es"];
var addon_domains = [];
var allowed_domains = "media.getusermedia.screensharing.allowed_domains";

function startup(data, reason) {
if (reason === APP_STARTUP) {
return;
}
var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
var values = prefs.getCharPref(allowed_domains).split(',');
domainsUsed.forEach(function (domain) {
if (values.indexOf(domain) === -1) {
values.push(domain);
addon_domains.push(domain);
}
});
prefs.setCharPref(allowed_domains, values.join(','));
}

function shutdown(data, reason) {
if (reason === APP_SHUTDOWN) {
return;
}
var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
var values = prefs.getCharPref(allowed_domains).split(',');
values = values.filter(function (value) {
return addon_domains.indexOf(value) === -1;
});
prefs.setCharPref(allowed_domains, values.join(','));
}

function install(data, reason) {}

function uninstall(data, reason) {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

echo "Creating FirefoxExtension.xpi..."

zip ./FirefoxExtension.xpi icon.png bootstrap.js install.rdf

echo "FirefoxExtension.xpi ready!"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions erizo_controller/erizoClient/extras/firefox-extension/install.rdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>[email protected]</em:id>
<em:type>2</em:type>
<em:name>Lynckia Screensharing</em:name>
<em:description>Extension to allow screen sharing in Licode applications.</em:description>
<em:version>1.0</em:version>
<em:bootstrap>true</em:bootstrap>
<em:creator>Lynckia</em:creator>
<em:homepageURL>lynckia.com/licode</em:homepageURL>
<em:iconURL></em:iconURL>
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>33.0</em:minVersion>
<em:maxVersion>100000.*</em:maxVersion>
</Description>
</em:targetApplication>
</Description>
</RDF>
68 changes: 37 additions & 31 deletions erizo_controller/erizoClient/src/Connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,38 +65,44 @@ Erizo.GetUserMedia = function (config, callback, error) {
navigator.msGetUserMedia);

if (config.screen){
L.Logger.debug("Screen access requested");
if (!window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./)[1] >= 34){
error({code:"This browser does not support screen sharing"});
return;
}
// Default extensionId - this extension is only usable in our server, please make your own extension
// based on the code in erizo_controller/erizoClient/extras/chrome-extension
var extensionId = "okeephmleflklcdebijnponpabbmmgeo";
if (config.extensionId){
L.Logger.debug("extensionId supplied, using " + config.extensionId);
extensionId = config.extensionId;
}
L.Logger.debug("Screen access on chrome stable, looking for extension");
try{
chrome.runtime.sendMessage(extensionId,{getStream:true}, function (response){
if (response==undefined){
L.Logger.debug("Access to screen denied");
var theError = {code:"Access to screen denied"};
error(theError);
return;
}
var theId = response.streamId;
config = {video: {mandatory: {chromeMediaSource: 'desktop', chromeMediaSourceId: theId }}};
navigator.getMedia(config,callback,error);
});
} catch (e){
L.Logger.debug("Lynckia screensharing plugin is not accessible ");
var theError = {code:"no_plugin_present"};
error(theError);
return;
if (Erizo.getBrowser() === "mozilla"){
L.Logger.debug("Screen access requested");
config = { video: { mediaSource: 'window' || 'screen' }};
navigator.getMedia(config,callback,error);
} else {
L.Logger.debug("Screen access requested");
if (!window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./)[1] >= 34){
error({code:"This browser does not support screen sharing"});
return;
}
// Default extensionId - this extension is only usable in our server, please make your own extension
// based on the code in erizo_controller/erizoClient/extras/chrome-extension
var extensionId = "okeephmleflklcdebijnponpabbmmgeo";
if (config.extensionId){
L.Logger.debug("extensionId supplied, using " + config.extensionId);
extensionId = config.extensionId;
}
L.Logger.debug("Screen access on chrome stable, looking for extension");
try{
chrome.runtime.sendMessage(extensionId,{getStream:true}, function (response){
if (response==undefined){
L.Logger.debug("Access to screen denied");
var theError = {code:"Access to screen denied"};
error(theError);
return;
}
var theId = response.streamId;
config = {video: {mandatory: {chromeMediaSource: 'desktop', chromeMediaSourceId: theId }}};
navigator.getMedia(config,callback,error);
});
} catch (e){
L.Logger.debug("Lynckia screensharing plugin is not accessible ");
var theError = {code:"no_plugin_present"};
error(theError);
return;
}
}
}else{
} else {
if (typeof module !== 'undefined' && module.exports) {
L.Logger.error('Video/audio streams not supported in erizofc yet');
} else {
Expand Down
13 changes: 13 additions & 0 deletions erizo_controller/erizoClient/src/webrtc-stacks/FirefoxStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,23 @@ Erizo.FirefoxStack = function (spec) {
var setLocalDesc = function (sessionDescription) {
sessionDescription.sdp = setMaxBW(sessionDescription.sdp);
sessionDescription.sdp = sessionDescription.sdp.replace(/a=ice-options:google-ice\r\n/g, "");
sessionDescription = changeOrder(sessionDescription);
spec.callback(sessionDescription);
localDesc = sessionDescription;
}

var changeOrder = function(sessionDescription) {
var matches = sessionDescription.sdp.match(/^.*(rtcp-fb).*$/gm);
var lines = "";
for (var i in matches){
if (i == 0) lines += matches[i];
else lines += "\n\r" + matches[i];
}
sessionDescription.sdp = sessionDescription.sdp.replace(/^.*(rtcp-fb).*$\r\n/gm, "");
sessionDescription.sdp += lines;
return sessionDescription;
}

var setLocalDescp2p = function (sessionDescription) {
sessionDescription.sdp = setMaxBW(sessionDescription.sdp);
sessionDescription.sdp = sessionDescription.sdp.replace(/a=ice-options:google-ice\r\n/g, "");
Expand Down
6 changes: 3 additions & 3 deletions erizo_controller/erizoController/erizoController.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,14 +489,14 @@ var listen = function () {
socket.emit('connection_failed',{});
socket.state = 'sleeping';
if (!socket.room.p2p) {
socket.room.controller.removePublisher(streamId);
socket.room.controller.removePublisher(id);
if (GLOBAL.config.erizoController.report.session_events) {
var timeStamp = new Date();
amqper.broadcast('event', {room: socket.room.id, user: socket.id, type: 'failed', stream: streamId, timestamp: timeStamp.getTime()});
amqper.broadcast('event', {room: socket.room.id, user: socket.id, type: 'failed', stream: id, timestamp: timeStamp.getTime()});
}
}

var index = socket.streams.indexOf(streamId);
var index = socket.streams.indexOf(id);
if (index !== -1) {
socket.streams.splice(index, 1);
}
Expand Down

0 comments on commit 620ffbd

Please sign in to comment.