@livekit/rtc-node 0.13.7 → 0.13.8
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/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.d.cts +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/video_source.cjs +6 -0
- package/dist/video_source.cjs.map +1 -1
- package/dist/video_source.d.cts +2 -0
- package/dist/video_source.d.ts +2 -0
- package/dist/video_source.d.ts.map +1 -1
- package/dist/video_source.js +6 -0
- package/dist/video_source.js.map +1 -1
- package/package.json +6 -6
- package/src/nodejs.rs +12 -5
- package/src/version.ts +1 -1
- package/src/video_source.ts +6 -0
package/dist/version.cjs
CHANGED
|
@@ -21,7 +21,7 @@ __export(version_exports, {
|
|
|
21
21
|
SDK_VERSION: () => SDK_VERSION
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(version_exports);
|
|
24
|
-
const SDK_VERSION = "0.13.
|
|
24
|
+
const SDK_VERSION = "0.13.8";
|
|
25
25
|
// Annotate the CommonJS export names for ESM import in node:
|
|
26
26
|
0 && (module.exports = {
|
|
27
27
|
SDK_VERSION
|
package/dist/version.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/version.ts"],"sourcesContent":["export const SDK_VERSION = \"0.13.
|
|
1
|
+
{"version":3,"sources":["../src/version.ts"],"sourcesContent":["export const SDK_VERSION = \"0.13.8\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,cAAc;","names":[]}
|
package/dist/version.d.cts
CHANGED
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/dist/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/version.ts"],"sourcesContent":["export const SDK_VERSION = \"0.13.
|
|
1
|
+
{"version":3,"sources":["../src/version.ts"],"sourcesContent":["export const SDK_VERSION = \"0.13.8\";\n"],"mappings":"AAAO,MAAM,cAAc;","names":[]}
|
package/dist/video_source.cjs
CHANGED
|
@@ -25,6 +25,8 @@ var import_ffi_client = require("./ffi_client.cjs");
|
|
|
25
25
|
var import_video_frame_pb = require("./proto/video_frame_pb.cjs");
|
|
26
26
|
class VideoSource {
|
|
27
27
|
constructor(width, height) {
|
|
28
|
+
/** @internal */
|
|
29
|
+
this.closed = false;
|
|
28
30
|
var _a;
|
|
29
31
|
this.width = width;
|
|
30
32
|
this.height = height;
|
|
@@ -45,6 +47,9 @@ class VideoSource {
|
|
|
45
47
|
this.ffiHandle = new import_ffi_client.FfiHandle(res.source.handle.id);
|
|
46
48
|
}
|
|
47
49
|
captureFrame(frame, timestampUs = BigInt(0), rotation = import_video_frame_pb.VideoRotation.VIDEO_ROTATION_0) {
|
|
50
|
+
if (this.closed) {
|
|
51
|
+
throw new Error("VideoSource is closed");
|
|
52
|
+
}
|
|
48
53
|
const req = new import_video_frame_pb.CaptureVideoFrameRequest({
|
|
49
54
|
sourceHandle: this.ffiHandle.handle,
|
|
50
55
|
buffer: frame.protoInfo(),
|
|
@@ -57,6 +62,7 @@ class VideoSource {
|
|
|
57
62
|
}
|
|
58
63
|
async close() {
|
|
59
64
|
this.ffiHandle.dispose();
|
|
65
|
+
this.closed = true;
|
|
60
66
|
}
|
|
61
67
|
}
|
|
62
68
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/video_source.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { FfiClient, FfiHandle } from './ffi_client.js';\nimport type {\n CaptureVideoFrameResponse,\n NewVideoSourceResponse,\n VideoSourceInfo,\n} from './proto/video_frame_pb.js';\nimport {\n CaptureVideoFrameRequest,\n NewVideoSourceRequest,\n VideoRotation,\n VideoSourceType,\n} from './proto/video_frame_pb.js';\nimport type { VideoFrame } from './video_frame.js';\n\nexport class VideoSource {\n /** @internal */\n info?: VideoSourceInfo;\n /** @internal */\n ffiHandle: FfiHandle;\n\n width: number;\n height: number;\n\n constructor(width: number, height: number) {\n this.width = width;\n this.height = height;\n\n const req = new NewVideoSourceRequest({\n type: VideoSourceType.VIDEO_SOURCE_NATIVE,\n resolution: {\n width: width,\n height: height,\n },\n });\n\n const res = FfiClient.instance.request<NewVideoSourceResponse>({\n message: {\n case: 'newVideoSource',\n value: req,\n },\n });\n\n this.info = res.source?.info;\n this.ffiHandle = new FfiHandle(res.source!.handle!.id!);\n }\n\n captureFrame(\n frame: VideoFrame,\n timestampUs = BigInt(0),\n rotation = VideoRotation.VIDEO_ROTATION_0,\n ) {\n const req = new CaptureVideoFrameRequest({\n sourceHandle: this.ffiHandle.handle,\n buffer: frame.protoInfo(),\n rotation,\n timestampUs,\n });\n\n FfiClient.instance.request<CaptureVideoFrameResponse>({\n message: { case: 'captureVideoFrame', value: req },\n });\n }\n\n async close() {\n this.ffiHandle.dispose();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAqC;AAMrC,4BAKO;AAGA,MAAM,YAAY;AAAA,
|
|
1
|
+
{"version":3,"sources":["../src/video_source.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { FfiClient, FfiHandle } from './ffi_client.js';\nimport type {\n CaptureVideoFrameResponse,\n NewVideoSourceResponse,\n VideoSourceInfo,\n} from './proto/video_frame_pb.js';\nimport {\n CaptureVideoFrameRequest,\n NewVideoSourceRequest,\n VideoRotation,\n VideoSourceType,\n} from './proto/video_frame_pb.js';\nimport type { VideoFrame } from './video_frame.js';\n\nexport class VideoSource {\n /** @internal */\n info?: VideoSourceInfo;\n /** @internal */\n ffiHandle: FfiHandle;\n /** @internal */\n closed = false;\n\n width: number;\n height: number;\n\n constructor(width: number, height: number) {\n this.width = width;\n this.height = height;\n\n const req = new NewVideoSourceRequest({\n type: VideoSourceType.VIDEO_SOURCE_NATIVE,\n resolution: {\n width: width,\n height: height,\n },\n });\n\n const res = FfiClient.instance.request<NewVideoSourceResponse>({\n message: {\n case: 'newVideoSource',\n value: req,\n },\n });\n\n this.info = res.source?.info;\n this.ffiHandle = new FfiHandle(res.source!.handle!.id!);\n }\n\n captureFrame(\n frame: VideoFrame,\n timestampUs = BigInt(0),\n rotation = VideoRotation.VIDEO_ROTATION_0,\n ) {\n if (this.closed) {\n throw new Error('VideoSource is closed');\n }\n const req = new CaptureVideoFrameRequest({\n sourceHandle: this.ffiHandle.handle,\n buffer: frame.protoInfo(),\n rotation,\n timestampUs,\n });\n\n FfiClient.instance.request<CaptureVideoFrameResponse>({\n message: { case: 'captureVideoFrame', value: req },\n });\n }\n\n async close() {\n this.ffiHandle.dispose();\n this.closed = true;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAqC;AAMrC,4BAKO;AAGA,MAAM,YAAY;AAAA,EAWvB,YAAY,OAAe,QAAgB;AAL3C;AAAA,kBAAS;AAvBX;AA6BI,SAAK,QAAQ;AACb,SAAK,SAAS;AAEd,UAAM,MAAM,IAAI,4CAAsB;AAAA,MACpC,MAAM,sCAAgB;AAAA,MACtB,YAAY;AAAA,QACV;AAAA,QACA;AAAA,MACF;AAAA,IACF,CAAC;AAED,UAAM,MAAM,4BAAU,SAAS,QAAgC;AAAA,MAC7D,SAAS;AAAA,QACP,MAAM;AAAA,QACN,OAAO;AAAA,MACT;AAAA,IACF,CAAC;AAED,SAAK,QAAO,SAAI,WAAJ,mBAAY;AACxB,SAAK,YAAY,IAAI,4BAAU,IAAI,OAAQ,OAAQ,EAAG;AAAA,EACxD;AAAA,EAEA,aACE,OACA,cAAc,OAAO,CAAC,GACtB,WAAW,oCAAc,kBACzB;AACA,QAAI,KAAK,QAAQ;AACf,YAAM,IAAI,MAAM,uBAAuB;AAAA,IACzC;AACA,UAAM,MAAM,IAAI,+CAAyB;AAAA,MACvC,cAAc,KAAK,UAAU;AAAA,MAC7B,QAAQ,MAAM,UAAU;AAAA,MACxB;AAAA,MACA;AAAA,IACF,CAAC;AAED,gCAAU,SAAS,QAAmC;AAAA,MACpD,SAAS,EAAE,MAAM,qBAAqB,OAAO,IAAI;AAAA,IACnD,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,QAAQ;AACZ,SAAK,UAAU,QAAQ;AACvB,SAAK,SAAS;AAAA,EAChB;AACF;","names":[]}
|
package/dist/video_source.d.cts
CHANGED
package/dist/video_source.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video_source.d.ts","sourceRoot":"","sources":["../src/video_source.ts"],"names":[],"mappings":"AAGA,OAAO,EAAa,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,KAAK,EAGV,eAAe,EAChB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAGL,aAAa,EAEd,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,qBAAa,WAAW;IACtB,gBAAgB;IAChB,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,gBAAgB;IAChB,SAAS,EAAE,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"video_source.d.ts","sourceRoot":"","sources":["../src/video_source.ts"],"names":[],"mappings":"AAGA,OAAO,EAAa,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,KAAK,EAGV,eAAe,EAChB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAGL,aAAa,EAEd,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,qBAAa,WAAW;IACtB,gBAAgB;IAChB,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,gBAAgB;IAChB,SAAS,EAAE,SAAS,CAAC;IACrB,gBAAgB;IAChB,MAAM,UAAS;IAEf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;gBAEH,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAuBzC,YAAY,CACV,KAAK,EAAE,UAAU,EACjB,WAAW,SAAY,EACvB,QAAQ,gBAAiC;IAiBrC,KAAK;CAIZ"}
|
package/dist/video_source.js
CHANGED
|
@@ -7,6 +7,8 @@ import {
|
|
|
7
7
|
} from "./proto/video_frame_pb.js";
|
|
8
8
|
class VideoSource {
|
|
9
9
|
constructor(width, height) {
|
|
10
|
+
/** @internal */
|
|
11
|
+
this.closed = false;
|
|
10
12
|
var _a;
|
|
11
13
|
this.width = width;
|
|
12
14
|
this.height = height;
|
|
@@ -27,6 +29,9 @@ class VideoSource {
|
|
|
27
29
|
this.ffiHandle = new FfiHandle(res.source.handle.id);
|
|
28
30
|
}
|
|
29
31
|
captureFrame(frame, timestampUs = BigInt(0), rotation = VideoRotation.VIDEO_ROTATION_0) {
|
|
32
|
+
if (this.closed) {
|
|
33
|
+
throw new Error("VideoSource is closed");
|
|
34
|
+
}
|
|
30
35
|
const req = new CaptureVideoFrameRequest({
|
|
31
36
|
sourceHandle: this.ffiHandle.handle,
|
|
32
37
|
buffer: frame.protoInfo(),
|
|
@@ -39,6 +44,7 @@ class VideoSource {
|
|
|
39
44
|
}
|
|
40
45
|
async close() {
|
|
41
46
|
this.ffiHandle.dispose();
|
|
47
|
+
this.closed = true;
|
|
42
48
|
}
|
|
43
49
|
}
|
|
44
50
|
export {
|
package/dist/video_source.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/video_source.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { FfiClient, FfiHandle } from './ffi_client.js';\nimport type {\n CaptureVideoFrameResponse,\n NewVideoSourceResponse,\n VideoSourceInfo,\n} from './proto/video_frame_pb.js';\nimport {\n CaptureVideoFrameRequest,\n NewVideoSourceRequest,\n VideoRotation,\n VideoSourceType,\n} from './proto/video_frame_pb.js';\nimport type { VideoFrame } from './video_frame.js';\n\nexport class VideoSource {\n /** @internal */\n info?: VideoSourceInfo;\n /** @internal */\n ffiHandle: FfiHandle;\n\n width: number;\n height: number;\n\n constructor(width: number, height: number) {\n this.width = width;\n this.height = height;\n\n const req = new NewVideoSourceRequest({\n type: VideoSourceType.VIDEO_SOURCE_NATIVE,\n resolution: {\n width: width,\n height: height,\n },\n });\n\n const res = FfiClient.instance.request<NewVideoSourceResponse>({\n message: {\n case: 'newVideoSource',\n value: req,\n },\n });\n\n this.info = res.source?.info;\n this.ffiHandle = new FfiHandle(res.source!.handle!.id!);\n }\n\n captureFrame(\n frame: VideoFrame,\n timestampUs = BigInt(0),\n rotation = VideoRotation.VIDEO_ROTATION_0,\n ) {\n const req = new CaptureVideoFrameRequest({\n sourceHandle: this.ffiHandle.handle,\n buffer: frame.protoInfo(),\n rotation,\n timestampUs,\n });\n\n FfiClient.instance.request<CaptureVideoFrameResponse>({\n message: { case: 'captureVideoFrame', value: req },\n });\n }\n\n async close() {\n this.ffiHandle.dispose();\n }\n}\n"],"mappings":"AAGA,SAAS,WAAW,iBAAiB;AAMrC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGA,MAAM,YAAY;AAAA,
|
|
1
|
+
{"version":3,"sources":["../src/video_source.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { FfiClient, FfiHandle } from './ffi_client.js';\nimport type {\n CaptureVideoFrameResponse,\n NewVideoSourceResponse,\n VideoSourceInfo,\n} from './proto/video_frame_pb.js';\nimport {\n CaptureVideoFrameRequest,\n NewVideoSourceRequest,\n VideoRotation,\n VideoSourceType,\n} from './proto/video_frame_pb.js';\nimport type { VideoFrame } from './video_frame.js';\n\nexport class VideoSource {\n /** @internal */\n info?: VideoSourceInfo;\n /** @internal */\n ffiHandle: FfiHandle;\n /** @internal */\n closed = false;\n\n width: number;\n height: number;\n\n constructor(width: number, height: number) {\n this.width = width;\n this.height = height;\n\n const req = new NewVideoSourceRequest({\n type: VideoSourceType.VIDEO_SOURCE_NATIVE,\n resolution: {\n width: width,\n height: height,\n },\n });\n\n const res = FfiClient.instance.request<NewVideoSourceResponse>({\n message: {\n case: 'newVideoSource',\n value: req,\n },\n });\n\n this.info = res.source?.info;\n this.ffiHandle = new FfiHandle(res.source!.handle!.id!);\n }\n\n captureFrame(\n frame: VideoFrame,\n timestampUs = BigInt(0),\n rotation = VideoRotation.VIDEO_ROTATION_0,\n ) {\n if (this.closed) {\n throw new Error('VideoSource is closed');\n }\n const req = new CaptureVideoFrameRequest({\n sourceHandle: this.ffiHandle.handle,\n buffer: frame.protoInfo(),\n rotation,\n timestampUs,\n });\n\n FfiClient.instance.request<CaptureVideoFrameResponse>({\n message: { case: 'captureVideoFrame', value: req },\n });\n }\n\n async close() {\n this.ffiHandle.dispose();\n this.closed = true;\n }\n}\n"],"mappings":"AAGA,SAAS,WAAW,iBAAiB;AAMrC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGA,MAAM,YAAY;AAAA,EAWvB,YAAY,OAAe,QAAgB;AAL3C;AAAA,kBAAS;AAvBX;AA6BI,SAAK,QAAQ;AACb,SAAK,SAAS;AAEd,UAAM,MAAM,IAAI,sBAAsB;AAAA,MACpC,MAAM,gBAAgB;AAAA,MACtB,YAAY;AAAA,QACV;AAAA,QACA;AAAA,MACF;AAAA,IACF,CAAC;AAED,UAAM,MAAM,UAAU,SAAS,QAAgC;AAAA,MAC7D,SAAS;AAAA,QACP,MAAM;AAAA,QACN,OAAO;AAAA,MACT;AAAA,IACF,CAAC;AAED,SAAK,QAAO,SAAI,WAAJ,mBAAY;AACxB,SAAK,YAAY,IAAI,UAAU,IAAI,OAAQ,OAAQ,EAAG;AAAA,EACxD;AAAA,EAEA,aACE,OACA,cAAc,OAAO,CAAC,GACtB,WAAW,cAAc,kBACzB;AACA,QAAI,KAAK,QAAQ;AACf,YAAM,IAAI,MAAM,uBAAuB;AAAA,IACzC;AACA,UAAM,MAAM,IAAI,yBAAyB;AAAA,MACvC,cAAc,KAAK,UAAU;AAAA,MAC7B,QAAQ,MAAM,UAAU;AAAA,MACxB;AAAA,MACA;AAAA,IACF,CAAC;AAED,cAAU,SAAS,QAAmC;AAAA,MACpD,SAAS,EAAE,MAAM,qBAAqB,OAAO,IAAI;AAAA,IACnD,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,QAAQ;AACZ,SAAK,UAAU,QAAQ;AACvB,SAAK,SAAS;AAAA,EAChB;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "LiveKit RTC Node",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"author": "LiveKit",
|
|
6
|
-
"version": "0.13.
|
|
6
|
+
"version": "0.13.8",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"require": "dist/index.cjs",
|
|
9
9
|
"types": "dist/index.d.ts",
|
|
@@ -61,11 +61,11 @@
|
|
|
61
61
|
"@bufbuild/protoc-gen-es": "^1.10.0"
|
|
62
62
|
},
|
|
63
63
|
"optionalDependencies": {
|
|
64
|
-
"@livekit/rtc-node-darwin-
|
|
65
|
-
"@livekit/rtc-node-
|
|
66
|
-
"@livekit/rtc-node-
|
|
67
|
-
"@livekit/rtc-node-linux-x64-gnu": "0.13.
|
|
68
|
-
"@livekit/rtc-node-win32-x64-msvc": "0.13.
|
|
64
|
+
"@livekit/rtc-node-darwin-x64": "0.13.8",
|
|
65
|
+
"@livekit/rtc-node-linux-arm64-gnu": "0.13.8",
|
|
66
|
+
"@livekit/rtc-node-darwin-arm64": "0.13.8",
|
|
67
|
+
"@livekit/rtc-node-linux-x64-gnu": "0.13.8",
|
|
68
|
+
"@livekit/rtc-node-win32-x64-msvc": "0.13.8"
|
|
69
69
|
},
|
|
70
70
|
"engines": {
|
|
71
71
|
"node": ">= 18"
|
package/src/nodejs.rs
CHANGED
|
@@ -40,23 +40,30 @@ fn livekit_initialize(cb: JsFunction, capture_logs: bool, sdk_version: String) {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
#[napi]
|
|
43
|
-
fn livekit_ffi_request(data: Uint8Array) -> Uint8Array {
|
|
43
|
+
fn livekit_ffi_request(data: Uint8Array) -> Result<Uint8Array> {
|
|
44
44
|
let data = data.to_vec();
|
|
45
45
|
let res = match proto::FfiRequest::decode(data.as_slice()) {
|
|
46
46
|
Ok(res) => res,
|
|
47
47
|
Err(err) => {
|
|
48
|
-
|
|
48
|
+
return Err(Error::from_reason(format!(
|
|
49
|
+
"failed to decode request: {}",
|
|
50
|
+
err.to_string()
|
|
51
|
+
)));
|
|
49
52
|
}
|
|
50
53
|
};
|
|
51
54
|
|
|
52
|
-
let res = match server::requests::handle_request(&FFI_SERVER, res) {
|
|
55
|
+
let res = match server::requests::handle_request(&FFI_SERVER, res.clone()) {
|
|
53
56
|
Ok(res) => res,
|
|
54
57
|
Err(err) => {
|
|
55
|
-
|
|
58
|
+
return Err(Error::from_reason(format!(
|
|
59
|
+
"failed to handle request: {} ({:?})",
|
|
60
|
+
err.to_string(),
|
|
61
|
+
res
|
|
62
|
+
)));
|
|
56
63
|
}
|
|
57
64
|
}
|
|
58
65
|
.encode_to_vec();
|
|
59
|
-
Uint8Array::new(res)
|
|
66
|
+
Ok(Uint8Array::new(res))
|
|
60
67
|
}
|
|
61
68
|
|
|
62
69
|
// FfiHandle must be used instead
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.13.
|
|
1
|
+
export const SDK_VERSION = "0.13.8";
|
package/src/video_source.ts
CHANGED
|
@@ -20,6 +20,8 @@ export class VideoSource {
|
|
|
20
20
|
info?: VideoSourceInfo;
|
|
21
21
|
/** @internal */
|
|
22
22
|
ffiHandle: FfiHandle;
|
|
23
|
+
/** @internal */
|
|
24
|
+
closed = false;
|
|
23
25
|
|
|
24
26
|
width: number;
|
|
25
27
|
height: number;
|
|
@@ -52,6 +54,9 @@ export class VideoSource {
|
|
|
52
54
|
timestampUs = BigInt(0),
|
|
53
55
|
rotation = VideoRotation.VIDEO_ROTATION_0,
|
|
54
56
|
) {
|
|
57
|
+
if (this.closed) {
|
|
58
|
+
throw new Error('VideoSource is closed');
|
|
59
|
+
}
|
|
55
60
|
const req = new CaptureVideoFrameRequest({
|
|
56
61
|
sourceHandle: this.ffiHandle.handle,
|
|
57
62
|
buffer: frame.protoInfo(),
|
|
@@ -66,5 +71,6 @@ export class VideoSource {
|
|
|
66
71
|
|
|
67
72
|
async close() {
|
|
68
73
|
this.ffiHandle.dispose();
|
|
74
|
+
this.closed = true;
|
|
69
75
|
}
|
|
70
76
|
}
|