WIP: Switch to Pako for zlib

This commit introduces an alternate implementation of the zlib
decompressor based on Pako (https://github.com/nodeca/pako).
This commit is contained in:
Solly Ross
2015-05-18 19:01:58 -04:00
parent 0442e153a1
commit 6940936ffc
12 changed files with 2495 additions and 14 deletions

2409
include/inflator.js Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -380,8 +380,9 @@ var RFB;
}
for (i = 0; i < 4; i++) {
this._FBU.zlibs[i] = new TINF();
this._FBU.zlibs[i].init();
//this._FBU.zlibs[i] = new TINF();
//this._FBU.zlibs[i].init();
this._FBU.zlibs[i] = new inflator.Inflate();
}
},
@@ -1181,7 +1182,14 @@ var RFB;
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();
this._timing.cur_fbu += (now - this._timing.last_fbu);
@@ -1639,12 +1647,14 @@ var RFB;
}
}
var uncompressed = this._FBU.zlibs[streamId].uncompress(data, 0);
if (uncompressed.status !== 0) {
//var uncompressed = this._FBU.zlibs[streamId].uncompress(data, 0);
var uncompressed = this._FBU.zlibs[streamId].inflate(data, true);
/*if (uncompressed.status !== 0) {
Util.Error("Invalid data in zlib stream");
}
}*/
return uncompressed.data;
//return uncompressed.data;
return uncompressed;
}.bind(this);
var indexedToRGB = function (data, numColors, palette, width, height) {

View File

@@ -21,7 +21,7 @@ var UI;
window.onscriptsload = function () { UI.load(); };
Util.load_scripts(["webutil.js", "base64.js", "websock.js", "des.js",
"keysymdef.js", "keyboard.js", "input.js", "display.js",
"jsunzip.js", "rfb.js", "keysym.js"]);
"rfb.js", "keysym.js", "inflator.js"]);
UI = {