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; let ret;
if (ctl === 0x08) { if (ctl === 0x08) {
Log.Info("Fill Rect");
ret = this._fillRect(x, y, width, height, ret = this._fillRect(x, y, width, height,
data, display, depth); data, display, depth);
} else if (ctl === 0x09) { } else if (ctl === 0x09) {
Log.Info("Fill JPEG");
ret = this._jpegRect(x, y, width, height, ret = this._jpegRect(x, y, width, height,
data, display, depth); data, display, depth);
} else if (ctl === 0x0A) { } else if (ctl === 0x0A) {
Log.Info("Fill Png");
ret = this._pngRect(x, y, width, height, ret = this._pngRect(x, y, width, height,
data, display, depth); data, display, depth);
} else if ((ctl & 0x08) == 0) { } else if ((ctl & 0x08) == 0) {
Log.Info("Fill Basic");
ret = this._basicRect(ctl, x, y, width, height, ret = this._basicRect(ctl, x, y, width, height,
data, display, depth); data, display, depth);
} else if (ctl === 0x0B) { } else if (ctl === 0x0B) {
Log.Info("Fill webp");
ret = this._webpRect(x, y, width, height, ret = this._webpRect(x, y, width, height,
data, display, depth); data, display, depth);
} else { } else {
@ -115,17 +110,14 @@ export default class UDPDecoder {
switch (filter) { switch (filter) {
case 0: // CopyFilter case 0: // CopyFilter
Log.Info("Filter Copy");
ret = this._copyFilter(streamId, x, y, width, height, ret = this._copyFilter(streamId, x, y, width, height,
data, display, depth, data_index); data, display, depth, data_index);
break; break;
case 1: // PaletteFilter case 1: // PaletteFilter
Log.Info("Filter Palette");
ret = this._paletteFilter(streamId, x, y, width, height, ret = this._paletteFilter(streamId, x, y, width, height,
data, display, depth); data, display, depth);
break; break;
case 2: // GradientFilter case 2: // GradientFilter
Log.Info("Filter Gradient");
ret = this._gradientFilter(streamId, x, y, width, height, ret = this._gradientFilter(streamId, x, y, width, height,
data, display, depth); data, display, depth);
break; break;
@ -146,7 +138,6 @@ export default class UDPDecoder {
if (uncompressedSize < 12) { if (uncompressedSize < 12) {
data = data.slice(data_index, data_index + uncompressedSize); data = data.slice(data_index, data_index + uncompressedSize);
//data = sock.rQshiftBytes(uncompressedSize);
} else { } else {
data = this._readData(data, data_index); data = this._readData(data, data_index);
if (data === null) { if (data === null) {
@ -186,7 +177,6 @@ export default class UDPDecoder {
} }
if (uncompressedSize < 12) { if (uncompressedSize < 12) {
//data = sock.rQshiftBytes(uncompressedSize);
data = data.slice(data_i, data_i + uncompressedSize); data = data.slice(data_i, data_i + uncompressedSize);
} else { } else {
data = this._readData(data, data_i); 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) { if (data.length !== len + i) {
console.log('Rect of size ' + len + ' with data size ' + data.length + ' index of ' + 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]; let udpurl = this._url.split("/")[2];
udpurl = udpurl.split(":")[0]; udpurl = udpurl.split(":")[0];
udpurl = "http://" + udpurl + ":" + 9555; udpurl = "http://" + udpurl + ":" + 9555;
//udpurl = window.location.protocol + "//" + udpurl + ":" + 9555; //udpurl = window.location.protocol + "//" + udpurl + ":" + 9555;
this._udpPeer = new RTCPeerConnection({ this._udpPeer = new RTCPeerConnection({
@ -980,7 +980,6 @@ export default class RFB extends EventTargetMixin {
(u8[11] << 24), 10); (u8[11] << 24), 10);
if (pieces == 1) { // Handle it immediately if (pieces == 1) { // Handle it immediately
Log.Info("Single Piece recieved");
me._handleUdpRect(u8.slice(12)); me._handleUdpRect(u8.slice(12));
} else { // Insert into wait array } else { // Insert into wait array
const now = Date.now(); const now = Date.now();
@ -1003,7 +1002,6 @@ export default class RFB extends EventTargetMixin {
finaldata.set(item.data[x], z); finaldata.set(item.data[x], z);
z += item.data[x].length; z += item.data[x].length;
} }
Log.Info('Completed message applied: ' + finaldata.length + ' ' + item.total_bytes + ' ' + item.total_pieces);
udpBuffer.delete(id); udpBuffer.delete(id);
me._handleUdpRect(finaldata); me._handleUdpRect(finaldata);
} }
@ -1027,7 +1025,7 @@ export default class RFB extends EventTargetMixin {
for (const [key, value] of udpBuffer.entries()) { for (const [key, value] of udpBuffer.entries()) {
// Drop any messages older than 100ms // Drop any messages older than 100ms
if (now - value.arrival > 100) { if (now - value.arrival > 100) {
Log.Info('Removed id: ' + key); Log.Info('Removed id: ' + key + ' Buffer size: ' + udpBuffer.size);
udpBuffer.delete(key); udpBuffer.delete(key);
} }
} }