livedesk 0.1.140 → 0.1.142
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
CHANGED
|
@@ -124,7 +124,7 @@ const DEFAULT_PUBLIC_IP_TIMEOUT_MS = 1800;
|
|
|
124
124
|
const DUPLICATE_DEVICE_ACTIVE_REJECT_MS = 15000;
|
|
125
125
|
const DUPLICATE_DEVICE_LOG_THROTTLE_MS = 60000;
|
|
126
126
|
const DUPLICATE_DEVICE_RETRY_AFTER_MS = 30000;
|
|
127
|
-
const AGENT_BINARY_INGRESS_QUEUE_PACKETS =
|
|
127
|
+
const AGENT_BINARY_INGRESS_QUEUE_PACKETS = 64;
|
|
128
128
|
const AGENT_BINARY_INGRESS_DRAIN_BUDGET_PACKETS = 64;
|
|
129
129
|
const SYNTHETIC_FRAME_DATA_URL = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAABCAYAAAD0In+KAAAADElEQVR42mP8z8AAAAMBAQDJ/pLvAAAAAElFTkSuQmCC';
|
|
130
130
|
const SYNTHETIC_FRAME_PAYLOAD = Buffer.from(SYNTHETIC_FRAME_DATA_URL.split(',')[1], 'base64');
|
|
@@ -3239,6 +3239,7 @@ export function createRemoteHub(options = {}) {
|
|
|
3239
3239
|
device.latestLiveFrame = {
|
|
3240
3240
|
streamId,
|
|
3241
3241
|
frameSeq,
|
|
3242
|
+
streamFrameSeq: Number.isFinite(Number(message.streamFrameSeq)) ? Number(message.streamFrameSeq) : frameSeq,
|
|
3242
3243
|
commandId,
|
|
3243
3244
|
width: Number.isFinite(Number(message.width)) ? Number(message.width) : 0,
|
|
3244
3245
|
height: Number.isFinite(Number(message.height)) ? Number(message.height) : 0,
|
|
@@ -3266,6 +3267,7 @@ export function createRemoteHub(options = {}) {
|
|
|
3266
3267
|
agentSendDurationFrameSeq: Number.isFinite(Number(message.agentSendDurationFrameSeq)) ? Number(message.agentSendDurationFrameSeq) : 0,
|
|
3267
3268
|
agentPaceMs: Number.isFinite(Number(message.agentPaceMs)) ? Number(message.agentPaceMs) : 0,
|
|
3268
3269
|
droppedByAgent: Number.isFinite(Number(message.droppedByAgent)) ? Number(message.droppedByAgent) : 0,
|
|
3270
|
+
hubIngressDropped: Number.isFinite(Number(message.hubIngressDropped)) ? Number(message.hubIngressDropped) : 0,
|
|
3269
3271
|
hardwareEncoder: safeString(message.hardwareEncoder, 80),
|
|
3270
3272
|
platformProfile: safeString(message.platformProfile, 80),
|
|
3271
3273
|
monitorIndex: Number.isFinite(Number(message.monitorIndex)) ? normalizeMonitorIndex(message.monitorIndex) : Number(device.activeLiveStream.monitorIndex || 0),
|
|
@@ -3429,7 +3431,10 @@ export function createRemoteHub(options = {}) {
|
|
|
3429
3431
|
}
|
|
3430
3432
|
|
|
3431
3433
|
if (frameKind === 'stream' || frameKind === 'live' || header.type === 'stream.binary') {
|
|
3432
|
-
applyLiveFrame(device,
|
|
3434
|
+
applyLiveFrame(device, {
|
|
3435
|
+
...header,
|
|
3436
|
+
hubIngressDropped: Number(state.binaryQueueDrops || 0)
|
|
3437
|
+
}, framePayload, 'binary');
|
|
3433
3438
|
return;
|
|
3434
3439
|
}
|
|
3435
3440
|
|
package/hub/src/server.js
CHANGED
|
@@ -21,7 +21,7 @@ const packageInfo = JSON.parse(readFileSync(resolve(__dirname, '..', 'package.js
|
|
|
21
21
|
const httpHost = process.env.LIVEDESK_HUB_HTTP_HOST || '127.0.0.1';
|
|
22
22
|
const httpPort = Number(process.env.LIVEDESK_HUB_HTTP_PORT || process.env.PORT || 5179);
|
|
23
23
|
const frameBackpressureBytes = readPositiveIntegerEnv('LIVEDESK_FRAME_WS_BACKPRESSURE_BYTES', 16 * 1024 * 1024);
|
|
24
|
-
const frameClientQueuePackets = readPositiveIntegerEnv('LIVEDESK_FRAME_WS_QUEUE_PACKETS',
|
|
24
|
+
const frameClientQueuePackets = readPositiveIntegerEnv('LIVEDESK_FRAME_WS_QUEUE_PACKETS', 64);
|
|
25
25
|
const frameClientDrainBudgetPackets = readPositiveIntegerEnv('LIVEDESK_FRAME_WS_DRAIN_BUDGET_PACKETS', 8);
|
|
26
26
|
const frameClients = new Set();
|
|
27
27
|
const frameClientsByDeviceId = new Map();
|
|
@@ -572,6 +572,10 @@ function enqueueFramePacketForClient(ws, packet, meta) {
|
|
|
572
572
|
}
|
|
573
573
|
if (ws.bufferedAmount > frameBackpressureBytes) {
|
|
574
574
|
ws.liveDeskFrameBackpressured = true;
|
|
575
|
+
lane.dropped += 1;
|
|
576
|
+
if (meta.isH264 && meta.deviceId) {
|
|
577
|
+
lane.awaitingKeyFrames.add(meta.deviceId);
|
|
578
|
+
}
|
|
575
579
|
ws.liveDeskFrameBackpressureDrops = Number(ws.liveDeskFrameBackpressureDrops || 0) + 1;
|
|
576
580
|
return false;
|
|
577
581
|
}
|
|
@@ -709,7 +713,7 @@ function updateAudioSubscription(ws, payload = {}) {
|
|
|
709
713
|
});
|
|
710
714
|
}
|
|
711
715
|
|
|
712
|
-
function buildRemoteFrameBinaryPacket(frameEvent) {
|
|
716
|
+
function buildRemoteFrameBinaryPacket(frameEvent, diagnostics = {}) {
|
|
713
717
|
const payload = frameEvent?.payload;
|
|
714
718
|
if (!Buffer.isBuffer(payload) || payload.length === 0) {
|
|
715
719
|
return null;
|
|
@@ -722,6 +726,7 @@ function buildRemoteFrameBinaryPacket(frameEvent) {
|
|
|
722
726
|
kind: frameEvent.kind || 'live',
|
|
723
727
|
deviceId: frameEvent.deviceId || frame.deviceId || '',
|
|
724
728
|
frameSeq: Number(frame.frameSeq || 0) || 0,
|
|
729
|
+
streamFrameSeq: Number(frame.streamFrameSeq || 0) || 0,
|
|
725
730
|
streamId: frame.streamId || '',
|
|
726
731
|
commandId: frame.commandId || '',
|
|
727
732
|
width: Number(frame.width || 0) || 0,
|
|
@@ -749,6 +754,8 @@ function buildRemoteFrameBinaryPacket(frameEvent) {
|
|
|
749
754
|
agentSendDurationFrameSeq: Number(frame.agentSendDurationFrameSeq || 0) || 0,
|
|
750
755
|
agentPaceMs: Number(frame.agentPaceMs || 0) || 0,
|
|
751
756
|
droppedByAgent: Number(frame.droppedByAgent || 0) || 0,
|
|
757
|
+
hubIngressDropped: Number(frame.hubIngressDropped || 0) || 0,
|
|
758
|
+
hubClientDropped: Number(diagnostics.hubClientDropped || 0) || 0,
|
|
752
759
|
hardwareEncoder: frame.hardwareEncoder || '',
|
|
753
760
|
platformProfile: frame.platformProfile || '',
|
|
754
761
|
fps: Number(frame.fps || 0) || 0,
|
|
@@ -810,19 +817,24 @@ function broadcastRemoteBinaryFrame(frameEvent) {
|
|
|
810
817
|
const isH264 = String(frame.codec || frame.mimeType || frame.format || '').toLowerCase().includes('h264')
|
|
811
818
|
|| String(frame.frameMode || frame.mode || '').toLowerCase() === 'mode3-h264-hw';
|
|
812
819
|
const isKeyFrame = frame.isKeyFrame === true || String(frame.chunkType || '').toLowerCase() === 'key';
|
|
813
|
-
const packet = buildRemoteFrameBinaryPacket(frameEvent);
|
|
814
|
-
if (!packet) {
|
|
815
|
-
return;
|
|
816
|
-
}
|
|
817
820
|
const frameSeq = Number(frame.frameSeq || 0) || 0;
|
|
818
821
|
for (const client of targetClients) {
|
|
819
822
|
if (client.readyState !== client.OPEN) {
|
|
820
823
|
continue;
|
|
821
824
|
}
|
|
825
|
+
const lane = ensureFrameClientSendLane(client);
|
|
822
826
|
if (client.liveDeskFrameBackpressured && isH264 && !isKeyFrame) {
|
|
827
|
+
lane.dropped += 1;
|
|
828
|
+
lane.awaitingKeyFrames.add(deviceId);
|
|
823
829
|
client.liveDeskFrameBackpressureDrops = Number(client.liveDeskFrameBackpressureDrops || 0) + 1;
|
|
824
830
|
continue;
|
|
825
831
|
}
|
|
832
|
+
const packet = buildRemoteFrameBinaryPacket(frameEvent, {
|
|
833
|
+
hubClientDropped: lane.dropped
|
|
834
|
+
});
|
|
835
|
+
if (!packet) {
|
|
836
|
+
continue;
|
|
837
|
+
}
|
|
826
838
|
enqueueFramePacketForClient(client, packet, { deviceId, frameSeq, isH264, isKeyFrame });
|
|
827
839
|
}
|
|
828
840
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "livedesk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.142",
|
|
4
4
|
"description": "LiveDesk Hub and client launcher",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"node": ">=20"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@livedesk/client": "0.1.
|
|
33
|
+
"@livedesk/client": "0.1.97",
|
|
34
34
|
"cors": "^2.8.5",
|
|
35
35
|
"express": "^4.21.2",
|
|
36
36
|
"path-to-regexp": "0.1.13",
|