livedesk 0.1.366 → 0.1.368

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.
@@ -5139,59 +5139,6 @@ export function createRemoteHub(options = {}) {
5139
5139
  safeString(stream?.streamPurpose, 24).toLowerCase() === 'control') || null;
5140
5140
  }
5141
5141
 
5142
- function stopCompetingMacCaptureStreams(deviceId, device, nextStreamId, nextPurpose) {
5143
- if (normalizeLivePlatform(device?.platform) !== 'macos') {
5144
- return { ok: true, stopped: [] };
5145
- }
5146
-
5147
- const activeControl = getActiveControlStream(device);
5148
- if (nextPurpose !== 'control'
5149
- && activeControl
5150
- && activeControl.streamId !== nextStreamId) {
5151
- return {
5152
- ok: true,
5153
- suppressed: true,
5154
- reason: 'CONTROL_CAPTURE_OWNS_DEVICE',
5155
- ownerStreamId: activeControl.streamId,
5156
- ownerCommandId: activeControl.commandId,
5157
- captureGeneration: Number(activeControl.captureGeneration || 0)
5158
- };
5159
- }
5160
-
5161
- const stopped = [];
5162
- for (const stream of getActiveLiveStreams(device)) {
5163
- if (!stream?.streamId || stream.streamId === nextStreamId) {
5164
- continue;
5165
- }
5166
- const stopCommandId = crypto.randomUUID();
5167
- const result = sendCommand(deviceId, {
5168
- command: 'stream.stop',
5169
- commandId: stopCommandId,
5170
- payload: {
5171
- streamId: stream.streamId,
5172
- requestedAt: new Date().toISOString(),
5173
- reason: `mac-capture-owner-transition:${nextPurpose}`
5174
- }
5175
- });
5176
- if (!result.ok) {
5177
- return {
5178
- ok: false,
5179
- error: 'CAPTURE_TRANSITION_IN_PROGRESS',
5180
- streamId: stream.streamId,
5181
- detail: result.error || 'stream-stop-dispatch-failed'
5182
- };
5183
- }
5184
- stream.active = false;
5185
- stream.pendingCommandId = '';
5186
- stream.pendingStartedAt = '';
5187
- stream.pendingRestartToken = '';
5188
- stream.stoppedAt = new Date().toISOString();
5189
- stream.stopReason = `mac-capture-owner-transition:${nextPurpose}`;
5190
- stopped.push({ streamId: stream.streamId, commandId: stopCommandId });
5191
- }
5192
- return { ok: true, stopped };
5193
- }
5194
-
5195
5142
  function nextCaptureGeneration(device) {
5196
5143
  const current = Number(device?.captureGenerationCounter || 0);
5197
5144
  const next = Number.isSafeInteger(current) && current > 0 ? current + 1 : 1;
@@ -5208,18 +5155,17 @@ export function createRemoteHub(options = {}) {
5208
5155
  }
5209
5156
 
5210
5157
  function normalizeLiveStreamStartOptions(options = {}) {
5211
- const transfer = buildRemoteFrameTransferDescriptor(options.mode || options.frameMode || DEFAULT_REMOTE_FRAME_MODE);
5212
- const streamPurpose = safeString(options.streamPurpose || options.purpose || 'wall', 24) || 'wall';
5213
- const platform = normalizeLivePlatform(options.platform);
5214
- const macWallProfile = platform === 'macos' && streamPurpose !== 'control';
5215
- const maxFps = streamPurpose === 'control' ? 60 : macWallProfile ? 8 : 30;
5216
- const defaultFps = macWallProfile && options.fps === undefined ? 4 : 8;
5217
- const maxWidth = clampNumber(options.maxWidth, 320, macWallProfile ? 432 : 3840, macWallProfile ? 432 : 640);
5218
- const maxHeight = clampNumber(options.maxHeight, 180, macWallProfile ? 243 : 2160, macWallProfile ? 243 : 360);
5219
- const fps = clampNumber(options.fps, 1, maxFps, defaultFps);
5220
- const quality = clampNumber(options.quality, 20, 95, 45);
5221
- const monitorIndex = normalizeMonitorIndex(options.monitorIndex ?? options.screenIndex ?? options.displayIndex);
5222
- return { fps, maxWidth, maxHeight, quality, monitorIndex, transfer, streamPurpose, platform, macWallProfile };
5158
+ const transfer = buildRemoteFrameTransferDescriptor(options.mode || options.frameMode || DEFAULT_REMOTE_FRAME_MODE);
5159
+ const streamPurpose = safeString(options.streamPurpose || options.purpose || 'wall', 24) || 'wall';
5160
+ const platform = normalizeLivePlatform(options.platform);
5161
+ const maxFps = streamPurpose === 'control' ? 60 : 30;
5162
+ const defaultFps = 8;
5163
+ const maxWidth = clampNumber(options.maxWidth, 320, 3840, 640);
5164
+ const maxHeight = clampNumber(options.maxHeight, 180, 2160, 360);
5165
+ const fps = clampNumber(options.fps, 1, maxFps, defaultFps);
5166
+ const quality = clampNumber(options.quality, 20, 95, 45);
5167
+ const monitorIndex = normalizeMonitorIndex(options.monitorIndex ?? options.screenIndex ?? options.displayIndex);
5168
+ return { fps, maxWidth, maxHeight, quality, monitorIndex, transfer, streamPurpose, platform };
5223
5169
  }
5224
5170
 
5225
5171
  function liveStreamStartStillPending(activeLiveStream) {
@@ -5374,30 +5320,6 @@ export function createRemoteHub(options = {}) {
5374
5320
  const { fps, maxWidth, maxHeight, quality, monitorIndex, transfer, streamPurpose } = normalized;
5375
5321
  const streamId = safeString(options.streamId, 128) || makeStableLiveStreamId(deviceId, streamPurpose);
5376
5322
  const activeLiveStream = getDeviceLiveStream(device, streamId);
5377
- const macTransition = stopCompetingMacCaptureStreams(deviceId, device, streamId, streamPurpose);
5378
- if (!macTransition.ok) {
5379
- return macTransition;
5380
- }
5381
- if (macTransition.suppressed) {
5382
- emitRemoteEvent('RemoteLiveStreamStartSuppressed', device, {
5383
- streamId,
5384
- streamPurpose,
5385
- reason: macTransition.reason,
5386
- ownerStreamId: macTransition.ownerStreamId,
5387
- ownerCommandId: macTransition.ownerCommandId,
5388
- captureGeneration: macTransition.captureGeneration
5389
- });
5390
- return {
5391
- ok: true,
5392
- suppressed: true,
5393
- streamId,
5394
- streamPurpose,
5395
- reason: macTransition.reason,
5396
- ownerStreamId: macTransition.ownerStreamId,
5397
- ownerCommandId: macTransition.ownerCommandId,
5398
- captureGeneration: macTransition.captureGeneration
5399
- };
5400
- }
5401
5323
  if (activeLiveStream?.pendingCommandId) {
5402
5324
  if (liveStreamReplacementStillPending(activeLiveStream)) {
5403
5325
  emitRemoteEvent('RemoteLiveStreamRestartPending', device, {
package/hub/src/server.js CHANGED
@@ -1756,10 +1756,13 @@ function buildRemoteFrameBinaryPacket(frameEvent, diagnostics = {}) {
1756
1756
  kind: frameEvent.kind || 'live',
1757
1757
  deviceId: frameEvent.deviceId || frame.deviceId || '',
1758
1758
  frameSeq: Number(frame.frameSeq || 0) || 0,
1759
- streamFrameSeq: Number(frame.streamFrameSeq || 0) || 0,
1760
- streamId: frame.streamId || '',
1761
- commandId: frame.commandId || '',
1762
- width: Number(frame.width || 0) || 0,
1759
+ streamFrameSeq: Number(frame.streamFrameSeq || 0) || 0,
1760
+ streamId: frame.streamId || '',
1761
+ commandId: frame.commandId || '',
1762
+ sessionId: frame.sessionId || '',
1763
+ captureGeneration: Number(frame.captureGeneration || 0) || 0,
1764
+ streamPurpose: frame.streamPurpose || '',
1765
+ width: Number(frame.width || 0) || 0,
1763
1766
  height: Number(frame.height || 0) || 0,
1764
1767
  sourceWidth: Number(frame.sourceWidth || 0) || 0,
1765
1768
  sourceHeight: Number(frame.sourceHeight || 0) || 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "livedesk",
3
- "version": "0.1.366",
3
+ "version": "0.1.368",
4
4
  "buildFlavor": "production",
5
5
  "description": "LiveDesk Hub and client launcher",
6
6
  "type": "module",
@@ -48,10 +48,10 @@
48
48
  "ws": "^8.18.3"
49
49
  },
50
50
  "optionalDependencies": {
51
- "@livedesk/fast-linux-x64": "0.1.366",
52
- "@livedesk/fast-osx-arm64": "0.1.366",
53
- "@livedesk/fast-osx-x64": "0.1.366",
54
- "@livedesk/fast-win-x64": "0.1.366"
51
+ "@livedesk/fast-linux-x64": "0.1.368",
52
+ "@livedesk/fast-osx-arm64": "0.1.368",
53
+ "@livedesk/fast-osx-x64": "0.1.368",
54
+ "@livedesk/fast-win-x64": "0.1.368"
55
55
  },
56
56
  "publishConfig": {
57
57
  "access": "public"