livedesk 0.1.153 → 0.1.154

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.
@@ -10,8 +10,8 @@ const DEFAULT_HEIGHT = 1080;
10
10
  const DEFAULT_FPS = 20;
11
11
  const MAX_DEVICES = 100;
12
12
  const FRAME_POOL_SIZE = 8;
13
- const MAX_TILE_WIDTH = 320;
14
- const MAX_TILE_HEIGHT = 180;
13
+ const MAX_TILE_WIDTH = 480;
14
+ const MAX_TILE_HEIGHT = 270;
15
15
 
16
16
  const rgb565Red = new Uint8Array(65_536);
17
17
  const rgb565Green = new Uint8Array(65_536);
@@ -52,11 +52,14 @@ function normalizeConfig(value) {
52
52
  .map(item => String(item || '').trim()).filter(Boolean))].slice(0, MAX_DEVICES);
53
53
  const maxWidth = clamp(value?.width, 640, 3840, DEFAULT_WIDTH);
54
54
  const maxHeight = clamp(value?.height, 360, 2160, DEFAULT_HEIGHT);
55
+ const sharpTiles = Number(value?.tileWidth) >= 480 || Number(value?.tileHeight) >= 270;
56
+ const sourceTileWidth = sharpTiles ? 480 : 320;
57
+ const sourceTileHeight = sharpTiles ? 270 : 180;
55
58
  const count = Math.max(1, deviceIds.length);
56
59
  const columns = Math.max(1, Math.ceil(Math.sqrt(count)));
57
60
  const rows = Math.max(1, Math.ceil(count / columns));
58
- const tileWidth = Math.max(2, Math.min(MAX_TILE_WIDTH, Math.floor(maxWidth / columns))) & ~1;
59
- const tileHeight = Math.max(2, Math.min(MAX_TILE_HEIGHT, Math.floor(maxHeight / rows))) & ~1;
61
+ const tileWidth = Math.max(2, Math.min(sourceTileWidth, Math.floor(maxWidth / columns))) & ~1;
62
+ const tileHeight = Math.max(2, Math.min(sourceTileHeight, Math.floor(maxHeight / rows))) & ~1;
60
63
  return {
61
64
  deviceIds,
62
65
  maxWidth,
@@ -67,6 +70,8 @@ function normalizeConfig(value) {
67
70
  rows,
68
71
  tileWidth,
69
72
  tileHeight,
73
+ sourceTileWidth,
74
+ sourceTileHeight,
70
75
  fps: clamp(value?.fps, 1, 30, DEFAULT_FPS)
71
76
  };
72
77
  }
@@ -289,8 +294,8 @@ function renderTile(tileState, tileLayout) {
289
294
  function ingestFrame(message) {
290
295
  const deviceId = String(message.deviceId || '');
291
296
  if (!deviceId || !config.deviceIds.includes(deviceId)) return;
292
- const width = clamp(message.width, 1, 320, 0);
293
- const height = clamp(message.height, 1, 180, 0);
297
+ const width = clamp(message.width, 1, config.sourceTileWidth, 0);
298
+ const height = clamp(message.height, 1, config.sourceTileHeight, 0);
294
299
  const expectedLength = width * height * 2;
295
300
  if (!width || !height || Number(message.uncompressedByteLength) !== expectedLength) return;
296
301
  try {
@@ -65,6 +65,8 @@ export class Mode4AtlasSession {
65
65
  deviceIds: this.deviceIds,
66
66
  width: Number(options.width || 1920),
67
67
  height: Number(options.height || 1080),
68
+ tileWidth: Number(options.tileWidth || 320),
69
+ tileHeight: Number(options.tileHeight || 180),
68
70
  fps: Number(options.fps || 20)
69
71
  };
70
72
  this.worker?.send({ type: 'configure', ...this.config });
package/hub/src/server.js CHANGED
@@ -944,18 +944,23 @@ function sendMode4AtlasFrame(ws, output) {
944
944
  function configureMode4Atlas(ws, payload = {}) {
945
945
  const deviceIds = normalizeDeviceIds(payload.deviceIds ?? payload.devices ?? payload.deviceId).slice(0, 100);
946
946
  const monitorSelections = normalizeMonitorSelections(payload.monitorSelections);
947
+ const sharpTiles = Number(payload.tileWidth) >= 480 || Number(payload.tileHeight) >= 270;
948
+ const tileWidth = sharpTiles ? 480 : 320;
949
+ const tileHeight = sharpTiles ? 270 : 180;
947
950
  ws.liveDeskAtlasDeviceIds = new Set(deviceIds);
948
951
  ws.liveDeskAtlasSession.configure({
949
952
  deviceIds,
950
953
  width: clampNumber(payload.width, 640, 3840, 1920),
951
954
  height: clampNumber(payload.height, 360, 2160, 1080),
955
+ tileWidth,
956
+ tileHeight,
952
957
  fps: clampNumber(payload.fps, 1, 30, 20)
953
958
  });
954
959
  for (const deviceId of deviceIds) {
955
960
  remoteHub.startLiveStream(deviceId, {
956
961
  fps: 8,
957
- maxWidth: 320,
958
- maxHeight: 180,
962
+ maxWidth: tileWidth,
963
+ maxHeight: tileHeight,
959
964
  quality: 60,
960
965
  mode: 'mode2-lzo',
961
966
  frameMode: 'mode2-lzo',
@@ -969,6 +974,8 @@ function configureMode4Atlas(ws, payload = {}) {
969
974
  deviceIds,
970
975
  inputMode: 'mode2-lzo',
971
976
  outputMode: 'mode4-h264-atlas',
977
+ tileWidth,
978
+ tileHeight,
972
979
  timestamp: new Date().toISOString()
973
980
  });
974
981
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "livedesk",
3
- "version": "0.1.153",
3
+ "version": "0.1.154",
4
4
  "description": "LiveDesk Hub and client launcher",
5
5
  "type": "module",
6
6
  "bin": {
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@ffmpeg-installer/ffmpeg": "^1.1.0",
34
- "@livedesk/client": "0.1.102",
34
+ "@livedesk/client": "0.1.103",
35
35
  "cors": "^2.8.5",
36
36
  "express": "^4.21.2",
37
37
  "ffmpeg-static": "^5.3.0",