Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@wasm-audio-decoders/flac

Package Overview
Dependencies
Maintainers
0
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wasm-audio-decoders/flac - npm Package Compare versions

Comparing version 0.2.4 to 0.2.5

4

package.json
{
"name": "@wasm-audio-decoders/flac",
"version": "0.2.4",
"version": "0.2.5",
"description": "Web Assembly streaming FLAC decoder",

@@ -55,4 +55,4 @@ "type": "module",

"@wasm-audio-decoders/common": "9.0.5",
"codec-parser": "2.4.3"
"codec-parser": "2.5.0"
}
}
# `@wasm-audio-decoders/flac`
`@wasm-audio-decoders/flac` is a Web Assembly FLAC / Ogg FLAC audio decoder.
* 64.8 KiB minified bundle size
* 65.3 KiB minified bundle size
* Browser and NodeJS support

@@ -6,0 +6,0 @@ * Built in Web Worker support

import { WASMAudioDecoderCommon } from "@wasm-audio-decoders/common";
import CodecParser, {
data,
absoluteGranulePosition,
samples,
totalSamples,
codecFrames,

@@ -189,2 +188,3 @@ isLastPage,

const init = Symbol();
const totalSamplesDecoded = Symbol();

@@ -209,4 +209,4 @@ export default class FLACDecoder {

this[decodeMethod] = placeholderDecodeMethod;
this[totalSamplesDecoded] = 0;
this._codecParser = null;
this._beginningSampleOffset = undefined;
}

@@ -260,25 +260,19 @@

const oggPage = oggPages[oggPages.length - 1];
if (oggPages.length && Number(oggPage[absoluteGranulePosition]) > -1) {
if (this._beginningSampleOffset === undefined) {
this._beginningSampleOffset =
oggPage[absoluteGranulePosition] - BigInt(oggPage[samples]);
}
if (oggPage && oggPage[isLastPage]) {
// trim any extra samples that are decoded beyond the absoluteGranulePosition, relative to where we started in the stream
const samplesToTrim = this[totalSamplesDecoded] - oggPage[totalSamples];
if (oggPage[isLastPage]) {
// trim any extra samples that are decoded beyond the absoluteGranulePosition, relative to where we started in the stream
const samplesToTrim =
decoded.samplesDecoded - Number(oggPage[absoluteGranulePosition]);
if (samplesToTrim > 0) {
for (let i = 0; i < decoded.channelData.length; i++)
decoded.channelData[i] = decoded.channelData[i].subarray(
0,
decoded.samplesDecoded - samplesToTrim,
);
if (samplesToTrim > 0) {
for (let i = 0; i < decoded.channelData.length; i++)
decoded.channelData[i] = decoded.channelData[i].subarray(
0,
decoded.samplesDecoded - samplesToTrim,
);
decoded.samplesDecoded -= samplesToTrim;
}
decoded.samplesDecoded -= samplesToTrim;
}
}
this[totalSamplesDecoded] += decoded.samplesDecoded;
return decoded;

@@ -285,0 +279,0 @@ }

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc