File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @livekit/rtc-node " : patch
3
+ ---
4
+
5
+ error on closed source on captureFrame
Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ export class AudioSource {
32
32
promise = this . newPromise ( ) ;
33
33
/** @internal */
34
34
timeout ?: ReturnType < typeof setTimeout > = undefined ;
35
+ /** @internal */
36
+ closed = false ;
35
37
36
38
sampleRate : number ;
37
39
numChannels : number ;
@@ -101,6 +103,9 @@ export class AudioSource {
101
103
}
102
104
103
105
async captureFrame ( frame : AudioFrame ) {
106
+ if ( this . closed ) {
107
+ throw new Error ( 'AudioSource is closed' ) ;
108
+ }
104
109
const now = Number ( process . hrtime . bigint ( ) / BigInt ( 1000000 ) ) ;
105
110
const elapsed = this . lastCapture === 0 ? 0 : now - this . lastCapture ;
106
111
const frameDurationMs = ( frame . samplesPerChannel / frame . sampleRate ) * 1000 ;
@@ -136,5 +141,6 @@ export class AudioSource {
136
141
137
142
async close ( ) {
138
143
this . ffiHandle . dispose ( ) ;
144
+ this . closed = true ;
139
145
}
140
146
}
You can’t perform that action at this time.
0 commit comments