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

Method createOutputBuffers

src/audio_encoder.ts:463–478  ·  view source on GitHub ↗
(frameSize: number)

Source from the content-addressed store, hash-verified

461 }
462
463 private createOutputBuffers(frameSize: number): Buffer[] {
464 assert(this.codecContext);
465 const bytesPerSample = this.getBytesPerSample(this.codecContext.sampleFormat);
466 const outputIsPlanar = this.formatIsPlanar(this.codecContext.sampleFormat);
467 const numChannels = this.codecContext.channels;
468
469 const outputBuffers: Buffer[] = [];
470 if (outputIsPlanar) {
471 for (let i = 0; i < numChannels; i++) {
472 outputBuffers.push(Buffer.alloc(frameSize * bytesPerSample));
473 }
474 } else {
475 outputBuffers.push(Buffer.alloc(frameSize * numChannels * bytesPerSample));
476 }
477 return outputBuffers;
478 }
479
480 private createInputSilenceBuffers(sampleCount: number): Buffer[] {
481 assert(this.codecContext);

Callers 1

pullResampledFramesMethod · 0.95

Calls 3

getBytesPerSampleMethod · 0.95
formatIsPlanarMethod · 0.95
assertFunction · 0.85

Tested by

no test coverage detected