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:
parent
ebe3129cb8
commit
0049d1fac3
File diff suppressed because it is too large
Load Diff
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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 = {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// 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
|
||||
/* jshint expr: true */
|
||||
var assert = chai.assert;
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@
|
|||
// Load supporting scripts
|
||||
Util.load_scripts(["base64.js", "websock.js", "des.js", "keysym.js",
|
||||
"keysymdef.js", "keyboard.js", "input.js", "display.js",
|
||||
"jsunzip.js", "rfb.js", "playback.js", fname]);
|
||||
"rfb.js", "playback.js", "inflator.js", fname]);
|
||||
|
||||
} else {
|
||||
message("Must specify data=FOO in query string.");
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@
|
|||
// Load supporting scripts
|
||||
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"]);
|
||||
"inflator.js", "rfb.js", "keysym.js"]);
|
||||
|
||||
var rfb;
|
||||
var resizeTimeout;
|
||||
|
|
|
|||
Loading…
Reference in New Issue