@livedesk/client 0.1.117 → 0.1.118

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.
@@ -2508,7 +2508,7 @@ function resolveBundledFfmpegPaths() {
2508
2508
  }
2509
2509
  };
2510
2510
 
2511
- if (process.platform === 'darwin') {
2511
+ if (process.platform === 'darwin' || process.platform === 'win32') {
2512
2512
  addFfmpegStatic();
2513
2513
  addFfmpegInstaller();
2514
2514
  } else {
@@ -3,6 +3,7 @@ import CoreGraphics
3
3
  import CoreMedia
4
4
  import CoreVideo
5
5
  import Foundation
6
+ import IOSurface
6
7
  import ScreenCaptureKit
7
8
  import VideoToolbox
8
9
 
@@ -23,6 +24,7 @@ final class LiveDeskScreenCaptureKitEncoder: NSObject, SCStreamOutput, SCStreamD
23
24
  private var encodedCount: Int = 0
24
25
  private var encodedKeyCount: Int = 0
25
26
  private var encodedDeltaCount: Int = 0
27
+ private var loggedInputSurface = false
26
28
 
27
29
  init(displayIndex: Int, width: Int, height: Int, fps: Int, bitrateKbps: Int) {
28
30
  self.displayIndex = max(0, displayIndex)
@@ -56,7 +58,7 @@ final class LiveDeskScreenCaptureKitEncoder: NSObject, SCStreamOutput, SCStreamD
56
58
  configuration.width = width
57
59
  configuration.height = height
58
60
  configuration.minimumFrameInterval = CMTime(value: 1, timescale: CMTimeScale(fps))
59
- configuration.queueDepth = 8
61
+ configuration.queueDepth = 3
60
62
  configuration.showsCursor = false
61
63
  configuration.pixelFormat = kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange
62
64
 
@@ -76,13 +78,20 @@ final class LiveDeskScreenCaptureKitEncoder: NSObject, SCStreamOutput, SCStreamD
76
78
  let encoderSpecification: [CFString: Any] = [
77
79
  kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder: true
78
80
  ]
81
+ let imageBufferAttributes: [CFString: Any] = [
82
+ kCVPixelBufferPixelFormatTypeKey: NSNumber(value: kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange),
83
+ kCVPixelBufferWidthKey: NSNumber(value: width),
84
+ kCVPixelBufferHeightKey: NSNumber(value: height),
85
+ kCVPixelBufferMetalCompatibilityKey: true,
86
+ kCVPixelBufferIOSurfacePropertiesKey: [:] as CFDictionary
87
+ ]
79
88
  let status = VTCompressionSessionCreate(
80
89
  allocator: kCFAllocatorDefault,
81
90
  width: Int32(width),
82
91
  height: Int32(height),
83
92
  codecType: kCMVideoCodecType_H264,
84
93
  encoderSpecification: encoderSpecification as CFDictionary,
85
- imageBufferAttributes: nil,
94
+ imageBufferAttributes: imageBufferAttributes as CFDictionary,
86
95
  compressedDataAllocator: nil,
87
96
  outputCallback: Self.compressionCallback,
88
97
  refcon: UnsafeMutableRawPointer(Unmanaged.passUnretained(self).toOpaque()),
@@ -93,9 +102,10 @@ final class LiveDeskScreenCaptureKitEncoder: NSObject, SCStreamOutput, SCStreamD
93
102
  }
94
103
 
95
104
  VTSessionSetProperty(session, key: kVTCompressionPropertyKey_RealTime, value: kCFBooleanTrue)
105
+ VTSessionSetProperty(session, key: kVTCompressionPropertyKey_PrioritizeEncodingSpeedOverQuality, value: kCFBooleanTrue)
96
106
  VTSessionSetProperty(session, key: kVTCompressionPropertyKey_AllowTemporalCompression, value: kCFBooleanTrue)
97
107
  VTSessionSetProperty(session, key: kVTCompressionPropertyKey_AllowFrameReordering, value: kCFBooleanFalse)
98
- VTSessionSetProperty(session, key: kVTCompressionPropertyKey_MaxFrameDelayCount, value: NSNumber(value: 1))
108
+ VTSessionSetProperty(session, key: kVTCompressionPropertyKey_MaxFrameDelayCount, value: NSNumber(value: 0))
99
109
  VTSessionSetProperty(session, key: kVTCompressionPropertyKey_ProfileLevel, value: kVTProfileLevel_H264_Baseline_AutoLevel)
100
110
  let recoveryKeyInterval = max(1, fps / 2)
101
111
  VTSessionSetProperty(session, key: kVTCompressionPropertyKey_MaxKeyFrameInterval, value: NSNumber(value: recoveryKeyInterval))
@@ -134,6 +144,12 @@ final class LiveDeskScreenCaptureKitEncoder: NSObject, SCStreamOutput, SCStreamD
134
144
  }
135
145
 
136
146
  frameCount += 1
147
+ if !loggedInputSurface {
148
+ loggedInputSurface = true
149
+ let pixelFormat = CVPixelBufferGetPixelFormatType(imageBuffer)
150
+ let hasIOSurface = CVPixelBufferGetIOSurface(imageBuffer) != nil
151
+ fputs("LiveDeskSCK input pixelFormat=\(pixelFormat) iosurface=\(hasIOSurface ? 1 : 0) queueDepth=3 zeroCopyCandidate=\(hasIOSurface ? 1 : 0)\n", stderr)
152
+ }
137
153
  let pts = CMSampleBufferGetPresentationTimeStamp(sampleBuffer)
138
154
  let duration = CMTime(value: 1, timescale: CMTimeScale(fps))
139
155
  var frameProperties: CFDictionary?
@@ -3,6 +3,7 @@ import CoreGraphics
3
3
  import CoreMedia
4
4
  import CoreVideo
5
5
  import Foundation
6
+ import IOSurface
6
7
  import ScreenCaptureKit
7
8
  import VideoToolbox
8
9
 
@@ -23,6 +24,7 @@ final class LiveDeskScreenCaptureKitEncoder: NSObject, SCStreamOutput, SCStreamD
23
24
  private var encodedCount: Int = 0
24
25
  private var encodedKeyCount: Int = 0
25
26
  private var encodedDeltaCount: Int = 0
27
+ private var loggedInputSurface = false
26
28
 
27
29
  init(displayIndex: Int, width: Int, height: Int, fps: Int, bitrateKbps: Int) {
28
30
  self.displayIndex = max(0, displayIndex)
@@ -56,7 +58,7 @@ final class LiveDeskScreenCaptureKitEncoder: NSObject, SCStreamOutput, SCStreamD
56
58
  configuration.width = width
57
59
  configuration.height = height
58
60
  configuration.minimumFrameInterval = CMTime(value: 1, timescale: CMTimeScale(fps))
59
- configuration.queueDepth = 8
61
+ configuration.queueDepth = 3
60
62
  configuration.showsCursor = false
61
63
  configuration.pixelFormat = kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange
62
64
 
@@ -76,13 +78,20 @@ final class LiveDeskScreenCaptureKitEncoder: NSObject, SCStreamOutput, SCStreamD
76
78
  let encoderSpecification: [CFString: Any] = [
77
79
  kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder: true
78
80
  ]
81
+ let imageBufferAttributes: [CFString: Any] = [
82
+ kCVPixelBufferPixelFormatTypeKey: NSNumber(value: kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange),
83
+ kCVPixelBufferWidthKey: NSNumber(value: width),
84
+ kCVPixelBufferHeightKey: NSNumber(value: height),
85
+ kCVPixelBufferMetalCompatibilityKey: true,
86
+ kCVPixelBufferIOSurfacePropertiesKey: [:] as CFDictionary
87
+ ]
79
88
  let status = VTCompressionSessionCreate(
80
89
  allocator: kCFAllocatorDefault,
81
90
  width: Int32(width),
82
91
  height: Int32(height),
83
92
  codecType: kCMVideoCodecType_H264,
84
93
  encoderSpecification: encoderSpecification as CFDictionary,
85
- imageBufferAttributes: nil,
94
+ imageBufferAttributes: imageBufferAttributes as CFDictionary,
86
95
  compressedDataAllocator: nil,
87
96
  outputCallback: Self.compressionCallback,
88
97
  refcon: UnsafeMutableRawPointer(Unmanaged.passUnretained(self).toOpaque()),
@@ -93,9 +102,10 @@ final class LiveDeskScreenCaptureKitEncoder: NSObject, SCStreamOutput, SCStreamD
93
102
  }
94
103
 
95
104
  VTSessionSetProperty(session, key: kVTCompressionPropertyKey_RealTime, value: kCFBooleanTrue)
105
+ VTSessionSetProperty(session, key: kVTCompressionPropertyKey_PrioritizeEncodingSpeedOverQuality, value: kCFBooleanTrue)
96
106
  VTSessionSetProperty(session, key: kVTCompressionPropertyKey_AllowTemporalCompression, value: kCFBooleanTrue)
97
107
  VTSessionSetProperty(session, key: kVTCompressionPropertyKey_AllowFrameReordering, value: kCFBooleanFalse)
98
- VTSessionSetProperty(session, key: kVTCompressionPropertyKey_MaxFrameDelayCount, value: NSNumber(value: 1))
108
+ VTSessionSetProperty(session, key: kVTCompressionPropertyKey_MaxFrameDelayCount, value: NSNumber(value: 0))
99
109
  VTSessionSetProperty(session, key: kVTCompressionPropertyKey_ProfileLevel, value: kVTProfileLevel_H264_Baseline_AutoLevel)
100
110
  let recoveryKeyInterval = max(1, fps / 2)
101
111
  VTSessionSetProperty(session, key: kVTCompressionPropertyKey_MaxKeyFrameInterval, value: NSNumber(value: recoveryKeyInterval))
@@ -134,6 +144,12 @@ final class LiveDeskScreenCaptureKitEncoder: NSObject, SCStreamOutput, SCStreamD
134
144
  }
135
145
 
136
146
  frameCount += 1
147
+ if !loggedInputSurface {
148
+ loggedInputSurface = true
149
+ let pixelFormat = CVPixelBufferGetPixelFormatType(imageBuffer)
150
+ let hasIOSurface = CVPixelBufferGetIOSurface(imageBuffer) != nil
151
+ fputs("LiveDeskSCK input pixelFormat=\(pixelFormat) iosurface=\(hasIOSurface ? 1 : 0) queueDepth=3 zeroCopyCandidate=\(hasIOSurface ? 1 : 0)\n", stderr)
152
+ }
137
153
  let pts = CMSampleBufferGetPresentationTimeStamp(sampleBuffer)
138
154
  let duration = CMTime(value: 1, timescale: CMTimeScale(fps))
139
155
  var frameProperties: CFDictionary?
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livedesk/client",
3
- "version": "0.1.117",
3
+ "version": "0.1.118",
4
4
  "description": "LiveDesk local remote client",
5
5
  "type": "module",
6
6
  "bin": {