@livedesk/client 0.1.95 → 0.1.97

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.
@@ -21,6 +21,8 @@ final class LiveDeskScreenCaptureKitEncoder: NSObject, SCStreamOutput, SCStreamD
21
21
  private var frameCount: Int = 0
22
22
  private var skippedCount: Int = 0
23
23
  private var encodedCount: Int = 0
24
+ private var encodedKeyCount: Int = 0
25
+ private var encodedDeltaCount: Int = 0
24
26
 
25
27
  init(displayIndex: Int, width: Int, height: Int, fps: Int, bitrateKbps: Int) {
26
28
  self.displayIndex = max(0, displayIndex)
@@ -91,6 +93,7 @@ final class LiveDeskScreenCaptureKitEncoder: NSObject, SCStreamOutput, SCStreamD
91
93
  }
92
94
 
93
95
  VTSessionSetProperty(session, key: kVTCompressionPropertyKey_RealTime, value: kCFBooleanTrue)
96
+ VTSessionSetProperty(session, key: kVTCompressionPropertyKey_AllowTemporalCompression, value: kCFBooleanTrue)
94
97
  VTSessionSetProperty(session, key: kVTCompressionPropertyKey_AllowFrameReordering, value: kCFBooleanFalse)
95
98
  VTSessionSetProperty(session, key: kVTCompressionPropertyKey_MaxFrameDelayCount, value: NSNumber(value: 1))
96
99
  VTSessionSetProperty(session, key: kVTCompressionPropertyKey_ProfileLevel, value: kVTProfileLevel_H264_Baseline_AutoLevel)
@@ -180,9 +183,10 @@ final class LiveDeskScreenCaptureKitEncoder: NSObject, SCStreamOutput, SCStreamD
180
183
  return
181
184
  }
182
185
 
186
+ let keyFrame = isKeyFrame(sampleBuffer)
183
187
  var output = Data()
184
188
  appendAccessUnitDelimiter(to: &output)
185
- if isKeyFrame(sampleBuffer), let formatDescription = CMSampleBufferGetFormatDescription(sampleBuffer) {
189
+ if keyFrame, let formatDescription = CMSampleBufferGetFormatDescription(sampleBuffer) {
186
190
  appendParameterSet(formatDescription, index: 0, to: &output)
187
191
  appendParameterSet(formatDescription, index: 1, to: &output)
188
192
  }
@@ -225,8 +229,13 @@ final class LiveDeskScreenCaptureKitEncoder: NSObject, SCStreamOutput, SCStreamD
225
229
  writeLock.unlock()
226
230
 
227
231
  encodedCount += 1
232
+ if keyFrame {
233
+ encodedKeyCount += 1
234
+ } else {
235
+ encodedDeltaCount += 1
236
+ }
228
237
  if encodedCount == 1 || encodedCount % max(1, fps * 5) == 0 {
229
- fputs("LiveDeskSCK encoded frames=\(encodedCount) bytes=\(output.count)\n", stderr)
238
+ fputs("LiveDeskSCK encoded frames=\(encodedCount) key=\(encodedKeyCount) delta=\(encodedDeltaCount) bytes=\(output.count)\n", stderr)
230
239
  }
231
240
  }
232
241
 
@@ -21,6 +21,8 @@ final class LiveDeskScreenCaptureKitEncoder: NSObject, SCStreamOutput, SCStreamD
21
21
  private var frameCount: Int = 0
22
22
  private var skippedCount: Int = 0
23
23
  private var encodedCount: Int = 0
24
+ private var encodedKeyCount: Int = 0
25
+ private var encodedDeltaCount: Int = 0
24
26
 
25
27
  init(displayIndex: Int, width: Int, height: Int, fps: Int, bitrateKbps: Int) {
26
28
  self.displayIndex = max(0, displayIndex)
@@ -91,6 +93,7 @@ final class LiveDeskScreenCaptureKitEncoder: NSObject, SCStreamOutput, SCStreamD
91
93
  }
92
94
 
93
95
  VTSessionSetProperty(session, key: kVTCompressionPropertyKey_RealTime, value: kCFBooleanTrue)
96
+ VTSessionSetProperty(session, key: kVTCompressionPropertyKey_AllowTemporalCompression, value: kCFBooleanTrue)
94
97
  VTSessionSetProperty(session, key: kVTCompressionPropertyKey_AllowFrameReordering, value: kCFBooleanFalse)
95
98
  VTSessionSetProperty(session, key: kVTCompressionPropertyKey_MaxFrameDelayCount, value: NSNumber(value: 1))
96
99
  VTSessionSetProperty(session, key: kVTCompressionPropertyKey_ProfileLevel, value: kVTProfileLevel_H264_Baseline_AutoLevel)
@@ -180,9 +183,10 @@ final class LiveDeskScreenCaptureKitEncoder: NSObject, SCStreamOutput, SCStreamD
180
183
  return
181
184
  }
182
185
 
186
+ let keyFrame = isKeyFrame(sampleBuffer)
183
187
  var output = Data()
184
188
  appendAccessUnitDelimiter(to: &output)
185
- if isKeyFrame(sampleBuffer), let formatDescription = CMSampleBufferGetFormatDescription(sampleBuffer) {
189
+ if keyFrame, let formatDescription = CMSampleBufferGetFormatDescription(sampleBuffer) {
186
190
  appendParameterSet(formatDescription, index: 0, to: &output)
187
191
  appendParameterSet(formatDescription, index: 1, to: &output)
188
192
  }
@@ -225,8 +229,13 @@ final class LiveDeskScreenCaptureKitEncoder: NSObject, SCStreamOutput, SCStreamD
225
229
  writeLock.unlock()
226
230
 
227
231
  encodedCount += 1
232
+ if keyFrame {
233
+ encodedKeyCount += 1
234
+ } else {
235
+ encodedDeltaCount += 1
236
+ }
228
237
  if encodedCount == 1 || encodedCount % max(1, fps * 5) == 0 {
229
- fputs("LiveDeskSCK encoded frames=\(encodedCount) bytes=\(output.count)\n", stderr)
238
+ fputs("LiveDeskSCK encoded frames=\(encodedCount) key=\(encodedKeyCount) delta=\(encodedDeltaCount) bytes=\(output.count)\n", stderr)
230
239
  }
231
240
  }
232
241
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livedesk/client",
3
- "version": "0.1.95",
3
+ "version": "0.1.97",
4
4
  "description": "LiveDesk local remote client",
5
5
  "type": "module",
6
6
  "bin": {