Merge main into release for tag v1.24.4

This commit is contained in:
github-actions[bot]
2025-11-06 09:03:56 +00:00
5 changed files with 35 additions and 12 deletions
+6 -6
View File
@@ -1,12 +1,12 @@
{ {
"name": "mediabunny", "name": "mediabunny",
"version": "1.24.3", "version": "1.24.4",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "mediabunny", "name": "mediabunny",
"version": "1.24.3", "version": "1.24.4",
"license": "MPL-2.0", "license": "MPL-2.0",
"workspaces": [ "workspaces": [
"packages/*" "packages/*"
@@ -7749,9 +7749,9 @@
} }
}, },
"node_modules/mediabunny": { "node_modules/mediabunny": {
"version": "1.24.2", "version": "1.24.3",
"resolved": "https://registry.npmjs.org/mediabunny/-/mediabunny-1.24.2.tgz", "resolved": "https://registry.npmjs.org/mediabunny/-/mediabunny-1.24.3.tgz",
"integrity": "sha512-+H2Jha7D8C92F1fysdN+nmBBAOgVV+pNv/Pxc+c//qo2E/idnv8MsZrft7VJsFE5WjK30ESkwW5ezM0oceFIkg==", "integrity": "sha512-uQu5lXg6c3z2YUKLimAsem1qYPdGfGziQ5CKaAMJAs0C0NNw5T/Zkn0foPML0gWqQJ5ZeC0wTgCxpiBQY8m1Tw==",
"license": "MPL-2.0", "license": "MPL-2.0",
"peer": true, "peer": true,
"workspaces": [ "workspaces": [
@@ -12242,7 +12242,7 @@
}, },
"packages/mp3-encoder": { "packages/mp3-encoder": {
"name": "@mediabunny/mp3-encoder", "name": "@mediabunny/mp3-encoder",
"version": "1.24.3", "version": "1.24.4",
"license": "MPL-2.0", "license": "MPL-2.0",
"devDependencies": { "devDependencies": {
"@types/emscripten": "^1.40.1" "@types/emscripten": "^1.40.1"
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "mediabunny", "name": "mediabunny",
"author": "Vanilagy", "author": "Vanilagy",
"version": "1.24.3", "version": "1.24.4",
"description": "Pure TypeScript media toolkit for reading, writing, and converting media files, directly in the browser.", "description": "Pure TypeScript media toolkit for reading, writing, and converting media files, directly in the browser.",
"type": "module", "type": "module",
"workspaces": [ "workspaces": [
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "@mediabunny/mp3-encoder", "name": "@mediabunny/mp3-encoder",
"author": "Vanilagy", "author": "Vanilagy",
"version": "1.24.3", "version": "1.24.4",
"description": "MP3 encoder extension for Mediabunny, based on LAME.", "description": "MP3 encoder extension for Mediabunny, based on LAME.",
"main": "./dist/bundles/mediabunny-mp3-encoder.mjs", "main": "./dist/bundles/mediabunny-mp3-encoder.mjs",
"module": "./dist/bundles/mediabunny-mp3-encoder.mjs", "module": "./dist/bundles/mediabunny-mp3-encoder.mjs",
+25 -2
View File
@@ -339,16 +339,34 @@ export class FlacDemuxer extends Demuxer {
slice.skip(-2); slice.skip(-2);
const lengthIfNextFlacFrameHeaderIsLegit = slice.filePos - startPos; const lengthIfNextFlacFrameHeaderIsLegit = slice.filePos - startPos;
const nextIsLegit = this.readFlacFrameHeader({ const nextFrameHeader = this.readFlacFrameHeader({
slice, slice,
isFirstPacket: false, isFirstPacket: false,
}); });
if (!nextIsLegit) { if (!nextFrameHeader) {
slice.skip(-1); slice.skip(-1);
continue; continue;
} }
// Ensure the frameOrSampleNum is consecutive.
// https://github.com/Vanilagy/mediabunny/issues/194
if (this.blockingBit === 0) {
// Case A: If the stream is fixed block size, this is the frame number, which increments by 1
if (nextFrameHeader.num - frameHeader.num !== 1) {
slice.skip(-1);
continue;
}
} else {
// Case B: If the stream is variable block size, this is the sample number, which increments by
// amount of samples in a frame.
if (nextFrameHeader.num - frameHeader.num !== frameHeader.blockSize) {
slice.skip(-1);
continue;
}
}
return { return {
num: frameHeader.num, num: frameHeader.num,
blockSize: frameHeader.blockSize, blockSize: frameHeader.blockSize,
@@ -442,6 +460,11 @@ export class FlacDemuxer extends Demuxer {
return null; return null;
} }
if (sampleRate !== this.audioInfo.sampleRate) {
// This cannot be a valid FLAC frame, the sample rate is not the same as in the stream info
return null;
}
const size = slice.filePos - startOffset; const size = slice.filePos - startOffset;
const crc = readU8(slice); const crc = readU8(slice);
+2 -2
View File
@@ -148,8 +148,8 @@ test('Can encode transparent video', async () => {
// Red (within error) // Red (within error)
expect(imageData.data[index2 + 0]).greaterThanOrEqual(253); expect(imageData.data[index2 + 0]).greaterThanOrEqual(253);
expect(imageData.data[index2 + 1]).lessThanOrEqual(2); expect(imageData.data[index2 + 1]).lessThanOrEqual(3);
expect(imageData.data[index2 + 2]).lessThanOrEqual(2); expect(imageData.data[index2 + 2]).lessThanOrEqual(3);
expect(imageData.data[index2 + 3]).toBe(255); // Opaque expect(imageData.data[index2 + 3]).toBe(255); // Opaque