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

Method close

src/audio_data.ts:324–347  ·  view source on GitHub ↗

* Closes the audio data and releases all resources.

()

Source from the content-addressed store, hash-verified

322 * Closes the audio data and releases all resources.
323 */
324 close(): void {
325 if (this.closed) {
326 return;
327 }
328
329 finalizationRegistry.unregister(this);
330 openAudioDataCount--;
331
332 if (this._data instanceof Frame) {
333 this._data.free();
334 }
335
336 // Spec: Close AudioData algorithm
337 this.closed = true;
338 this._data = null;
339 // @ts-expect-error Readonly
340 this.format = null;
341 // @ts-expect-error Readonly
342 this.sampleRate = 0;
343 // @ts-expect-error Readonly
344 this.numberOfFrames = 0;
345 // @ts-expect-error Readonly
346 this.numberOfChannels = 0;
347 }
348}
349
350const getBytesPerSample = (format: AudioSampleFormat): number => {

Callers 4

Calls

no outgoing calls

Tested by

no test coverage detected