Skip to content

Commit

Permalink
#122 make it easier to toggle offscreen decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Feb 3, 2022
1 parent eae465d commit 81dbf9c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
20 changes: 18 additions & 2 deletions html5/connect.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
<script src="js/lib/es6-shim.js"></script>
<script src="js/lib/AudioContextMonkeyPatch.js"></script>

<script type="text/javascript" src="js/RgbHelpers.js"></script>
<script type="text/javascript" src="js/ImageDecoder.js"></script>
<script type="text/javascript" src="js/VideoDecoder.js"></script>
<script type="text/javascript" src="js/OffscreenDecodeWorkerHelper.js"></script>

<script src="js/lib/jquery.js"></script>
<script src="js/Utilities.js"></script>
<script src="js/MediaSourceUtil.js"></script>
Expand Down Expand Up @@ -144,7 +149,7 @@ <h4 class="panel-title">Advanced options</h4>
<option value="png">PNG</option>
<option value="rgb">Raw RGB</option>
</select>
Encoding
Encoding &nbsp; <input type="checkbox" id="offscreen"> <span id="offscreen_label">offscreen decoding</span>
</li>

<li class="list-group-item">
Expand Down Expand Up @@ -330,13 +335,15 @@ <h4 class="panel-title">Advanced options</h4>
<script>

const VALUE_PROPERTIES = ["server", "port", "path", "username", "password", "key",
"bandwidth_limit", "encoding", "keyboard_layout", "audio_codec", "toolbar_position",
"bandwidth_limit", "encoding",
"keyboard_layout", "audio_codec", "toolbar_position",
"display", "shadow_display", "override_width",
"encryption",
"vrefresh",
];
const BOOLEAN_PROPERTIES = ["keyboard", "clipboard", "printing", "file_transfer",
"sound", "ignore_audio_blacklist",
"offscreen",
"exit_with_children", "exit_with_client",
"sharing", "steal", "reconnect", "swap_keys",
"scroll_reverse_x", "scroll_reverse_y",
Expand Down Expand Up @@ -1072,6 +1079,15 @@ <h4 class="panel-title">Advanced options</h4>
const encoding = getparam("encoding") || "auto";
document.getElementById('encoding').value = encoding;

const offscreen = getboolparam("offscreen", XpraOffscreenWorker.isAvailable());
document.getElementById("offscreen").checked = offscreen;
if (!XpraOffscreenWorker.isAvailable()) {
document.getElementById("offscreen").disabled = true;
document.getElementById("offscreen").setAttribute("title", "not available in your browser");
document.getElementById("offscreen_label").classList.add('disabled');
document.getElementById("offscreen_label").setAttribute("title", "not available in your browser");
}

let bandwidth_limit = getparam("bandwidth_limit");
if(bandwidth_limit==null) {
const ci = Utilities.getConnectionInfo();
Expand Down
3 changes: 3 additions & 0 deletions html5/css/signin.css
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ div.container {
font-size: smaller;
padding-left: 10px;
}
.form-signin span.disabled {
color: grey;
}

.form-signin img.field-icon {
margin-left: -32px;
Expand Down
2 changes: 2 additions & 0 deletions html5/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,7 @@ <h2>Xpra Bug Report</h2>
}
const sound = getboolparam("sound", true) || null;
const audio_codec = getparam("audio_codec") || null;
const offscreen = getboolparam("offscreen", true);
const encoding = getparam("encoding") || null;
const bandwidth_limit = getintparam("bandwidth_limit", 0) || 0;
const action = getparam("action") || "connect";
Expand Down Expand Up @@ -740,6 +741,7 @@ <h2>Xpra Bug Report</h2>
// the primary encoding
client.set_encoding(encoding);
}
client.offscreen_api = offscreen && client.offscreen_api;

if(action && (action!="connect")) {
const sns = {
Expand Down
2 changes: 2 additions & 0 deletions html5/js/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,10 @@ XpraClient.prototype.initialize_workers = function() {
}
let decode_worker;
if (this.offscreen_api) {
me.clog("using offscreen decode worker");
decode_worker = new Worker('js/OffscreenDecodeWorker.js');
} else {
me.clog("using decode worker");
decode_worker = new Worker('js/DecodeWorker.js');
}
decode_worker.addEventListener('message', function(e) {
Expand Down

0 comments on commit 81dbf9c

Please sign in to comment.