WIP cleanup

This commit is contained in:
Matt McClaskey 2022-02-17 15:59:32 -05:00
parent 6da3b14d02
commit a20a433044
2 changed files with 3 additions and 15 deletions

View File

@ -30,23 +30,18 @@ export default class UDPDecoder {
let ret;
if (ctl === 0x08) {
Log.Info("Fill Rect");
ret = this._fillRect(x, y, width, height,
data, display, depth);
} else if (ctl === 0x09) {
Log.Info("Fill JPEG");
ret = this._jpegRect(x, y, width, height,
data, display, depth);
} else if (ctl === 0x0A) {
Log.Info("Fill Png");
ret = this._pngRect(x, y, width, height,
data, display, depth);
} else if ((ctl & 0x08) == 0) {
Log.Info("Fill Basic");
ret = this._basicRect(ctl, x, y, width, height,
data, display, depth);
} else if (ctl === 0x0B) {
Log.Info("Fill webp");
ret = this._webpRect(x, y, width, height,
data, display, depth);
} else {
@ -115,17 +110,14 @@ export default class UDPDecoder {
switch (filter) {
case 0: // CopyFilter
Log.Info("Filter Copy");
ret = this._copyFilter(streamId, x, y, width, height,
data, display, depth, data_index);
break;
case 1: // PaletteFilter
Log.Info("Filter Palette");
ret = this._paletteFilter(streamId, x, y, width, height,
data, display, depth);
break;
case 2: // GradientFilter
Log.Info("Filter Gradient");
ret = this._gradientFilter(streamId, x, y, width, height,
data, display, depth);
break;
@ -146,7 +138,6 @@ export default class UDPDecoder {
if (uncompressedSize < 12) {
data = data.slice(data_index, data_index + uncompressedSize);
//data = sock.rQshiftBytes(uncompressedSize);
} else {
data = this._readData(data, data_index);
if (data === null) {
@ -186,7 +177,6 @@ export default class UDPDecoder {
}
if (uncompressedSize < 12) {
//data = sock.rQshiftBytes(uncompressedSize);
data = data.slice(data_i, data_i + uncompressedSize);
} else {
data = this._readData(data, data_i);
@ -281,7 +271,7 @@ export default class UDPDecoder {
}
}
// get rid of me
//TODO: get rid of me
if (data.length !== len + i) {
console.log('Rect of size ' + len + ' with data size ' + data.length + ' index of ' + i);
}

View File

@ -928,7 +928,7 @@ export default class RFB extends EventTargetMixin {
let udpurl = this._url.split("/")[2];
udpurl = udpurl.split(":")[0];
udpurl = "http://" + udpurl + ":" + 9555;
udpurl = "http://" + udpurl + ":" + 9555;
//udpurl = window.location.protocol + "//" + udpurl + ":" + 9555;
this._udpPeer = new RTCPeerConnection({
@ -980,7 +980,6 @@ export default class RFB extends EventTargetMixin {
(u8[11] << 24), 10);
if (pieces == 1) { // Handle it immediately
Log.Info("Single Piece recieved");
me._handleUdpRect(u8.slice(12));
} else { // Insert into wait array
const now = Date.now();
@ -1003,7 +1002,6 @@ export default class RFB extends EventTargetMixin {
finaldata.set(item.data[x], z);
z += item.data[x].length;
}
Log.Info('Completed message applied: ' + finaldata.length + ' ' + item.total_bytes + ' ' + item.total_pieces);
udpBuffer.delete(id);
me._handleUdpRect(finaldata);
}
@ -1027,7 +1025,7 @@ export default class RFB extends EventTargetMixin {
for (const [key, value] of udpBuffer.entries()) {
// Drop any messages older than 100ms
if (now - value.arrival > 100) {
Log.Info('Removed id: ' + key);
Log.Info('Removed id: ' + key + ' Buffer size: ' + udpBuffer.size);
udpBuffer.delete(key);
}
}