Commit 0049d1fa authored by Solly Ross's avatar Solly Ross

WIP: Switch to Pako for zlib

This commit introduces an alternate implementation of the zlib
decompressor based on Pako (https://github.com/nodeca/pako).
parent ebe3129c
This diff is collapsed.
...@@ -380,8 +380,9 @@ var RFB; ...@@ -380,8 +380,9 @@ var RFB;
} }
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
this._FBU.zlibs[i] = new TINF(); //this._FBU.zlibs[i] = new TINF();
this._FBU.zlibs[i].init(); //this._FBU.zlibs[i].init();
this._FBU.zlibs[i] = new inflator.Inflate();
} }
}, },
...@@ -1181,7 +1182,14 @@ var RFB; ...@@ -1181,7 +1182,14 @@ var RFB;
this._timing.last_fbu = (new Date()).getTime(); this._timing.last_fbu = (new Date()).getTime();
ret = this._encHandlers[this._FBU.encoding](); var handler = this._encHandlers[this._FBU.encoding];
try {
//ret = this._encHandlers[this._FBU.encoding]();
ret = handler();
} catch (ex) {
console.log("missed " + this._FBU.encoding + ": " + handler);
ret = this._encHandlers[this._FBU.encoding]();
}
now = (new Date()).getTime(); now = (new Date()).getTime();
this._timing.cur_fbu += (now - this._timing.last_fbu); this._timing.cur_fbu += (now - this._timing.last_fbu);
...@@ -1639,12 +1647,14 @@ var RFB; ...@@ -1639,12 +1647,14 @@ var RFB;
} }
} }
var uncompressed = this._FBU.zlibs[streamId].uncompress(data, 0); //var uncompressed = this._FBU.zlibs[streamId].uncompress(data, 0);
if (uncompressed.status !== 0) { var uncompressed = this._FBU.zlibs[streamId].inflate(data, true);
/*if (uncompressed.status !== 0) {
Util.Error("Invalid data in zlib stream"); Util.Error("Invalid data in zlib stream");
} }*/
return uncompressed.data; //return uncompressed.data;
return uncompressed;
}.bind(this); }.bind(this);
var indexedToRGB = function (data, numColors, palette, width, height) { var indexedToRGB = function (data, numColors, palette, width, height) {
......
...@@ -21,7 +21,7 @@ var UI; ...@@ -21,7 +21,7 @@ var UI;
window.onscriptsload = function () { UI.load(); }; window.onscriptsload = function () { UI.load(); };
Util.load_scripts(["webutil.js", "base64.js", "websock.js", "des.js", Util.load_scripts(["webutil.js", "base64.js", "websock.js", "des.js",
"keysymdef.js", "keyboard.js", "input.js", "display.js", "keysymdef.js", "keyboard.js", "input.js", "display.js",
"jsunzip.js", "rfb.js", "keysym.js"]); "rfb.js", "keysym.js", "inflator.js"]);
UI = { UI = {
......
// requires local modules: util, base64, websock, rfb, keyboard, keysym, keysymdef, input, jsunzip, des, display // requires local modules: util, base64, websock, rfb, keyboard, keysym, keysymdef, input, inflator, des, display
// requires test modules: fake.websocket, assertions // requires test modules: fake.websocket, assertions
/* jshint expr: true */ /* jshint expr: true */
var assert = chai.assert; var assert = chai.assert;
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
// Load supporting scripts // Load supporting scripts
Util.load_scripts(["base64.js", "websock.js", "des.js", "keysym.js", Util.load_scripts(["base64.js", "websock.js", "des.js", "keysym.js",
"keysymdef.js", "keyboard.js", "input.js", "display.js", "keysymdef.js", "keyboard.js", "input.js", "display.js",
"jsunzip.js", "rfb.js", "playback.js", fname]); "rfb.js", "playback.js", "inflator.js", fname]);
} else { } else {
message("Must specify data=FOO in query string."); message("Must specify data=FOO in query string.");
......
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
// Load supporting scripts // Load supporting scripts
Util.load_scripts(["webutil.js", "base64.js", "websock.js", "des.js", Util.load_scripts(["webutil.js", "base64.js", "websock.js", "des.js",
"keysymdef.js", "keyboard.js", "input.js", "display.js", "keysymdef.js", "keyboard.js", "input.js", "display.js",
"jsunzip.js", "rfb.js", "keysym.js"]); "inflator.js", "rfb.js", "keysym.js"]);
var rfb; var rfb;
var resizeTimeout; var resizeTimeout;
......
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