MCPcopy Create free account
hub / github.com/Vanilagy/webcodecs-polyfill / close

Method close

src/video_frame.ts:453–485  ·  view source on GitHub ↗

* Closes the frame and releases all resources.

()

Source from the content-addressed store, hash-verified

451 * Closes the frame and releases all resources.
452 */
453 close() {
454 if (this.closed) {
455 return;
456 }
457 this.closed = true;
458
459 finalizationRegistry.unregister(this);
460 openVideoFrameCount--;
461
462 assert(this.data);
463
464 if (this.data instanceof Frame) {
465 this.data.free();
466 }
467 this.data = null; // To alloc GC to kick
468
469 // @ts-expect-error Readonly
470 this.format = null;
471 // @ts-expect-error Readonly
472 this.codedWidth = 0;
473 // @ts-expect-error Readonly
474 this.codedHeight = 0;
475 // @ts-expect-error Readonly
476 this.displayWidth = 0;
477 // @ts-expect-error Readonly
478 this.displayHeight = 0;
479 // @ts-expect-error Readonly
480 this.codedRect = new DOMRectReadOnlyPolyfill();
481 // @ts-expect-error Readonly
482 this.visibleRect = new DOMRectReadOnlyPolyfill();
483 // @ts-expect-error Readonly
484 this.flip = false;
485 }
486}
487
488// Helper type for internal layout storage

Callers 1

copyToMethod · 0.45

Calls 1

assertFunction · 0.85

Tested by

no test coverage detected