livedesk 0.1.113 → 0.1.114
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/hub/src/remote-hub.js +18 -5
- package/hub/src/server.js +7 -1
- package/package.json +1 -1
package/hub/src/remote-hub.js
CHANGED
|
@@ -1016,9 +1016,21 @@ class RemoteHubWebSocketAgentSocket {
|
|
|
1016
1016
|
this.onCloseMessage = () => {};
|
|
1017
1017
|
}
|
|
1018
1018
|
|
|
1019
|
-
setNoDelay() {
|
|
1019
|
+
setNoDelay(value = true) {
|
|
1020
|
+
try {
|
|
1021
|
+
this.socket?.setNoDelay?.(value);
|
|
1022
|
+
} catch {
|
|
1023
|
+
// Best-effort latency hint.
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1020
1026
|
|
|
1021
|
-
setKeepAlive() {
|
|
1027
|
+
setKeepAlive(value = true, initialDelay = 0) {
|
|
1028
|
+
try {
|
|
1029
|
+
this.socket?.setKeepAlive?.(value, initialDelay);
|
|
1030
|
+
} catch {
|
|
1031
|
+
// Best-effort connection liveness hint.
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1022
1034
|
|
|
1023
1035
|
sendJson(payload) {
|
|
1024
1036
|
return this.sendText(JSON.stringify(payload));
|
|
@@ -1670,7 +1682,7 @@ export function createRemoteHub(options = {}) {
|
|
|
1670
1682
|
transferProtocol: descriptor.transferProtocol,
|
|
1671
1683
|
transferProtocolVersion: descriptor.transferProtocolVersion,
|
|
1672
1684
|
handshake: descriptor.handshake,
|
|
1673
|
-
fps: clampNumber(options.fps, 1,
|
|
1685
|
+
fps: clampNumber(options.fps, 1, 20, mode === 'thumbnail' ? 1 : 2),
|
|
1674
1686
|
capturedAt: now,
|
|
1675
1687
|
receivedAt: now,
|
|
1676
1688
|
byteLength: 68,
|
|
@@ -3963,12 +3975,13 @@ export function createRemoteHub(options = {}) {
|
|
|
3963
3975
|
}
|
|
3964
3976
|
|
|
3965
3977
|
function normalizeLiveStreamStartOptions(options = {}) {
|
|
3966
|
-
const
|
|
3978
|
+
const transfer = buildRemoteFrameTransferDescriptor(options.mode || options.frameMode || DEFAULT_REMOTE_FRAME_MODE);
|
|
3979
|
+
const maxFps = transfer.frameMode === 'mode3-h264-hw' ? 20 : 30;
|
|
3980
|
+
const fps = clampNumber(options.fps, 1, maxFps, 8);
|
|
3967
3981
|
const maxWidth = clampNumber(options.maxWidth, 320, 3840, 640);
|
|
3968
3982
|
const maxHeight = clampNumber(options.maxHeight, 180, 2160, 360);
|
|
3969
3983
|
const quality = clampNumber(options.quality, 20, 95, 45);
|
|
3970
3984
|
const monitorIndex = normalizeMonitorIndex(options.monitorIndex ?? options.screenIndex ?? options.displayIndex);
|
|
3971
|
-
const transfer = buildRemoteFrameTransferDescriptor(options.mode || options.frameMode || DEFAULT_REMOTE_FRAME_MODE);
|
|
3972
3985
|
return { fps, maxWidth, maxHeight, quality, monitorIndex, transfer };
|
|
3973
3986
|
}
|
|
3974
3987
|
|
package/hub/src/server.js
CHANGED
|
@@ -177,8 +177,9 @@ function normalizeTransferFiles(value) {
|
|
|
177
177
|
|
|
178
178
|
function normalizeLiveOptions(payload = {}) {
|
|
179
179
|
const mode = String(payload.frameMode || payload.mode || 'mode3-h264-hw').trim() || 'mode3-h264-hw';
|
|
180
|
+
const maxFps = mode === 'mode3-h264-hw' ? 20 : 30;
|
|
180
181
|
return {
|
|
181
|
-
fps: clampNumber(payload.fps, 1,
|
|
182
|
+
fps: clampNumber(payload.fps, 1, maxFps, 2),
|
|
182
183
|
maxWidth: clampNumber(payload.maxWidth, 320, 3840, 640),
|
|
183
184
|
maxHeight: clampNumber(payload.maxHeight, 180, 2160, 360),
|
|
184
185
|
quality: clampNumber(payload.quality, 20, 95, 45),
|
|
@@ -788,6 +789,11 @@ httpServer.on('upgrade', (req, socket, head) => {
|
|
|
788
789
|
frameWss.on('connection', (ws, req) => {
|
|
789
790
|
frameClients.add(ws);
|
|
790
791
|
ws.liveDeskFrameClientId = `rfws-${++frameClientSeq}`;
|
|
792
|
+
try {
|
|
793
|
+
ws._socket?.setNoDelay?.(true);
|
|
794
|
+
} catch {
|
|
795
|
+
// Best-effort latency hint for browser frame sockets.
|
|
796
|
+
}
|
|
791
797
|
const cleanup = () => {
|
|
792
798
|
frameClients.delete(ws);
|
|
793
799
|
};
|