File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -211,7 +211,9 @@ export class Decoder {
211211 } ,
212212 error : ( error ) => console . error ( error ) ,
213213 } ) ;
214- effect . cleanup ( ( ) => decoder . close ( ) ) ;
214+ effect . cleanup ( ( ) => {
215+ if ( decoder . state !== "closed" ) decoder . close ( ) ;
216+ } ) ;
215217
216218 const description = config . description ? Util . Hex . toBytes ( config . description ) : undefined ;
217219 decoder . configure ( {
@@ -262,7 +264,9 @@ export class Decoder {
262264 output : ( data ) => this . #emit( data ) ,
263265 error : ( error ) => console . error ( error ) ,
264266 } ) ;
265- effect . cleanup ( ( ) => decoder . close ( ) ) ;
267+ effect . cleanup ( ( ) => {
268+ if ( decoder . state !== "closed" ) decoder . close ( ) ;
269+ } ) ;
266270
267271 // Configure decoder with description from catalog
268272 decoder . configure ( {
Original file line number Diff line number Diff line change @@ -270,7 +270,9 @@ class DecoderTrack {
270270 effect . close ( ) ;
271271 } ,
272272 } ) ;
273- effect . cleanup ( ( ) => decoder . close ( ) ) ;
273+ effect . cleanup ( ( ) => {
274+ if ( decoder . state !== "closed" ) decoder . close ( ) ;
275+ } ) ;
274276
275277 // Input processing - depends on container type
276278 if ( this . config . container . kind === "cmaf" ) {
You can’t perform that action at this time.
0 commit comments