Skip to content

Commit

Permalink
Remove distinction between simulcast and simulcast2 in janus.js (#2887)
Browse files Browse the repository at this point in the history
  • Loading branch information
lminiero authored Feb 17, 2022
1 parent b47a78d commit eae2947
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 32 deletions.
2 changes: 0 additions & 2 deletions html/canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ var audioenabled = false;
var videoenabled = false;

var doSimulcast = (getQueryStringValue("simulcast") === "yes" || getQueryStringValue("simulcast") === "true");
var doSimulcast2 = (getQueryStringValue("simulcast2") === "yes" || getQueryStringValue("simulcast2") === "true");
var acodec = (getQueryStringValue("acodec") !== "" ? getQueryStringValue("acodec") : null);
var vcodec = (getQueryStringValue("vcodec") !== "" ? getQueryStringValue("vcodec") : null);
var vprofile = (getQueryStringValue("vprofile") !== "" ? getQueryStringValue("vprofile") : null);
Expand Down Expand Up @@ -465,7 +464,6 @@ function createCanvas() {
// pass a ?simulcast=true when opening this demo page: it will turn
// the following 'simulcast' property to pass to janus.js to true
simulcast: doSimulcast,
simulcast2: doSimulcast2,
success: function(jsep) {
Janus.debug("Got SDP!", jsep);
echotest.send({ message: body, jsep: jsep });
Expand Down
2 changes: 0 additions & 2 deletions html/devicetest.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ var audioenabled = false;
var videoenabled = false;

var doSimulcast = (getQueryStringValue("simulcast") === "yes" || getQueryStringValue("simulcast") === "true");
var doSimulcast2 = (getQueryStringValue("simulcast2") === "yes" || getQueryStringValue("simulcast2") === "true");
var acodec = (getQueryStringValue("acodec") !== "" ? getQueryStringValue("acodec") : null);
var vcodec = (getQueryStringValue("vcodec") !== "" ? getQueryStringValue("vcodec") : null);
var vprofile = (getQueryStringValue("vprofile") !== "" ? getQueryStringValue("vprofile") : null);
Expand Down Expand Up @@ -175,7 +174,6 @@ function restartCapture() {
// pass a ?simulcast=true when opening this demo page: it will turn
// the following 'simulcast' property to pass to janus.js to true
simulcast: doSimulcast,
simulcast2: doSimulcast2,
success: function(jsep) {
Janus.debug("Got SDP!", jsep);
echotest.send({ message: body, jsep: jsep });
Expand Down
2 changes: 0 additions & 2 deletions html/e2etest.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ var audioenabled = false;
var videoenabled = false;

var doSimulcast = (getQueryStringValue("simulcast") === "yes" || getQueryStringValue("simulcast") === "true");
var doSimulcast2 = (getQueryStringValue("simulcast2") === "yes" || getQueryStringValue("simulcast2") === "true");
var acodec = (getQueryStringValue("acodec") !== "" ? getQueryStringValue("acodec") : null);
var vcodec = (getQueryStringValue("vcodec") !== "" ? getQueryStringValue("vcodec") : null);
var simulcastStarted = false;
Expand Down Expand Up @@ -643,7 +642,6 @@ function promptCryptoKey() {
// pass a ?simulcast=true when opening this demo page: it will turn
// the following 'simulcast' property to pass to janus.js to true.
simulcast: doSimulcast,
simulcast2: doSimulcast2,
// Since we want to use Insertable Streams,
// we specify the transform functions to use
senderTransforms: senderTransforms,
Expand Down
2 changes: 0 additions & 2 deletions html/echotest.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ var audioenabled = false;
var videoenabled = false;

var doSimulcast = (getQueryStringValue("simulcast") === "yes" || getQueryStringValue("simulcast") === "true");
var doSimulcast2 = (getQueryStringValue("simulcast2") === "yes" || getQueryStringValue("simulcast2") === "true");
var doSvc = getQueryStringValue("svc");
if(doSvc === "")
doSvc = null;
Expand Down Expand Up @@ -132,7 +131,6 @@ $(document).ready(function() {
// pass a ?simulcast=true when opening this demo page: it will turn
// the following 'simulcast' property to pass to janus.js to true
simulcast: doSimulcast,
simulcast2: doSimulcast2,
svc: (vcodec === 'av1' && doSvc) ? doSvc : null,
customizeSdp: function(jsep) {
// If DTX is enabled, munge the SDP
Expand Down
27 changes: 11 additions & 16 deletions html/janus.js
Original file line number Diff line number Diff line change
Expand Up @@ -1978,14 +1978,14 @@ function Janus(gatewayCallbacks) {
}
if(addTracks && stream) {
Janus.log('Adding local stream');
var simulcast2 = (callbacks.simulcast2 === true);
var simulcast = (callbacks.simulcast === true || callbacks.simulcast2 === true) && Janus.unifiedPlan;
var svc = callbacks.svc;
stream.getTracks().forEach(function(track) {
Janus.log('Adding local track:', track);
var sender = null;
if((!simulcast2 && !svc) || track.kind === 'audio') {
if((!simulcast && !svc) || track.kind === 'audio') {
sender = config.pc.addTrack(track, stream);
} else if(simulcast2) {
} else if(simulcast) {
Janus.log('Enabling rid-based simulcasting:', track);
let maxBitrates = getMaxBitrates(callbacks.simulcastMaxBitrates);
let tr = config.pc.addTransceiver(track, {
Expand Down Expand Up @@ -2353,10 +2353,9 @@ function Janus(gatewayCallbacks) {
audioSupport = media.audio;
var videoSupport = isVideoSendEnabled(media);
if(videoSupport && media) {
var simulcast = (callbacks.simulcast === true);
var simulcast2 = (callbacks.simulcast2 === true);
var simulcast = (callbacks.simulcast === true || callbacks.simulcast2 === true);
var svc = callbacks.svc;
if((simulcast || simulcast2 || svc) && !jsep && !media.video)
if((simulcast || svc) && !jsep && !media.video)
media.video = "hires";
if(media.video && media.video != 'screen' && media.video != 'window') {
if(typeof media.video === 'object') {
Expand Down Expand Up @@ -2678,7 +2677,7 @@ function Janus(gatewayCallbacks) {
return;
}
var config = pluginHandle.webrtcStuff;
var simulcast = (callbacks.simulcast === true);
var simulcast = (callbacks.simulcast === true || callbacks.simulcast2 === true);
if(!simulcast) {
Janus.log("Creating offer (iceDone=" + config.iceDone + ")");
} else {
Expand Down Expand Up @@ -2845,14 +2844,12 @@ function Janus(gatewayCallbacks) {
callbacks.customizeSdp(jsep);
offer.sdp = jsep.sdp;
Janus.log("Setting local description");
if(sendVideo && simulcast) {
// This SDP munging only works with Chrome (Safari STP may support it too)
if(sendVideo && simulcast && !Janus.unifiedPlan) {
// We only do simulcast via SDP munging on older versions of Chrome and Safari
if(Janus.webRTCAdapter.browserDetails.browser === "chrome" ||
Janus.webRTCAdapter.browserDetails.browser === "safari") {
Janus.log("Enabling Simulcasting for Chrome (SDP munging)");
offer.sdp = mungeSdpForSimulcasting(offer.sdp);
} else if(Janus.webRTCAdapter.browserDetails.browser !== "firefox") {
Janus.warn("simulcast=true, but this is not Chrome nor Firefox, ignoring");
}
}
config.mySdp = {
Expand Down Expand Up @@ -2887,7 +2884,7 @@ function Janus(gatewayCallbacks) {
return;
}
var config = pluginHandle.webrtcStuff;
var simulcast = (callbacks.simulcast === true);
var simulcast = (callbacks.simulcast === true || callbacks.simulcast2 === true);
if(!simulcast) {
Janus.log("Creating answer (iceDone=" + config.iceDone + ")");
} else {
Expand Down Expand Up @@ -3088,15 +3085,13 @@ function Janus(gatewayCallbacks) {
callbacks.customizeSdp(jsep);
answer.sdp = jsep.sdp;
Janus.log("Setting local description");
if(sendVideo && simulcast) {
// This SDP munging only works with Chrome
if(sendVideo && simulcast && !Janus.unifiedPlan) {
// We only do simulcast via SDP munging on older versions of Chrome and Safari
if(Janus.webRTCAdapter.browserDetails.browser === "chrome") {
// FIXME Apparently trying to simulcast when answering breaks video in Chrome...
//~ Janus.log("Enabling Simulcasting for Chrome (SDP munging)");
//~ answer.sdp = mungeSdpForSimulcasting(answer.sdp);
Janus.warn("simulcast=true, but this is an answer, and video breaks in Chrome if we enable it");
} else if(Janus.webRTCAdapter.browserDetails.browser !== "firefox") {
Janus.warn("simulcast=true, but this is not Chrome nor Firefox, ignoring");
}
}
config.mySdp = {
Expand Down
2 changes: 0 additions & 2 deletions html/multiopus.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ var audioenabled = false;
var videoenabled = false;

var doSimulcast = (getQueryStringValue("simulcast") === "yes" || getQueryStringValue("simulcast") === "true");
var doSimulcast2 = (getQueryStringValue("simulcast2") === "yes" || getQueryStringValue("simulcast2") === "true");
var acodec = "multiopus";
var vcodec = (getQueryStringValue("vcodec") !== "" ? getQueryStringValue("vcodec") : null);
var vprofile = (getQueryStringValue("vprofile") !== "" ? getQueryStringValue("vprofile") : null);
Expand Down Expand Up @@ -139,7 +138,6 @@ $(document).ready(function() {
// pass a ?simulcast=true when opening this demo page: it will turn
// the following 'simulcast' property to pass to janus.js to true
simulcast: doSimulcast,
simulcast2: doSimulcast2,
customizeSdp(jsep) {
// Offer multiopus
jsep.sdp = jsep.sdp
Expand Down
2 changes: 0 additions & 2 deletions html/mvideoroomtest.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ var localTracks = {}, localVideos = 0, remoteTracks = {};
var bitrateTimer = [], simulcastStarted = {};

var doSimulcast = (getQueryStringValue("simulcast") === "yes" || getQueryStringValue("simulcast") === "true");
var doSimulcast2 = (getQueryStringValue("simulcast2") === "yes" || getQueryStringValue("simulcast2") === "true");
var acodec = (getQueryStringValue("acodec") !== "" ? getQueryStringValue("acodec") : null);
var vcodec = (getQueryStringValue("vcodec") !== "" ? getQueryStringValue("vcodec") : null);
var subscriber_mode = (getQueryStringValue("subscriber-mode") === "yes" || getQueryStringValue("subscriber-mode") === "true");
Expand Down Expand Up @@ -481,7 +480,6 @@ function publishOwnFeed(useAudio) {
// pass a ?simulcast=true when opening this demo page: it will turn
// the following 'simulcast' property to pass to janus.js to true
simulcast: doSimulcast,
simulcast2: doSimulcast2,
success: function(jsep) {
Janus.debug("Got publisher SDP!");
Janus.debug(jsep);
Expand Down
1 change: 0 additions & 1 deletion html/recordplaytest.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ var acodec = (getQueryStringValue("acodec") !== "" ? getQueryStringValue("acodec
var vcodec = (getQueryStringValue("vcodec") !== "" ? getQueryStringValue("vcodec") : null);
var vprofile = (getQueryStringValue("vprofile") !== "" ? getQueryStringValue("vprofile") : null);
var doSimulcast = (getQueryStringValue("simulcast") === "yes" || getQueryStringValue("simulcast") === "true");
var doSimulcast2 = (getQueryStringValue("simulcast2") === "yes" || getQueryStringValue("simulcast2") === "true");
var doOpusred = (getQueryStringValue("opusred") === "yes" || getQueryStringValue("opusred") === "true");
var recordData = (getQueryStringValue("data") !== "" ? getQueryStringValue("data") : null);
if(recordData !== "text" && recordData !== "binary")
Expand Down
1 change: 0 additions & 1 deletion html/videocalltest.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ var myusername = null;
var yourusername = null;

var doSimulcast = (getQueryStringValue("simulcast") === "yes" || getQueryStringValue("simulcast") === "true");
var doSimulcast2 = (getQueryStringValue("simulcast2") === "yes" || getQueryStringValue("simulcast2") === "true");
var simulcastStarted = false;

$(document).ready(function() {
Expand Down
2 changes: 0 additions & 2 deletions html/videoroomtest.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ var feeds = [], feedStreams = {};
var bitrateTimer = [];

var doSimulcast = (getQueryStringValue("simulcast") === "yes" || getQueryStringValue("simulcast") === "true");
var doSimulcast2 = (getQueryStringValue("simulcast2") === "yes" || getQueryStringValue("simulcast2") === "true");
var acodec = (getQueryStringValue("acodec") !== "" ? getQueryStringValue("acodec") : null);
var vcodec = (getQueryStringValue("vcodec") !== "" ? getQueryStringValue("vcodec") : null);
var doDtx = (getQueryStringValue("dtx") === "yes" || getQueryStringValue("dtx") === "true");
Expand Down Expand Up @@ -485,7 +484,6 @@ function publishOwnFeed(useAudio) {
// pass a ?simulcast=true when opening this demo page: it will turn
// the following 'simulcast' property to pass to janus.js to true
simulcast: doSimulcast,
simulcast2: doSimulcast2,
customizeSdp: function(jsep) {
// If DTX is enabled, munge the SDP
if(doDtx) {
Expand Down

0 comments on commit eae2947

Please sign in to comment.