mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-09-27 02:43:48 +02:00
Fix incorrect MP3 frame size calculation (fixes #140)
This commit is contained in:
+3
-3
@@ -52,11 +52,11 @@ export const computeMp3FrameSize = (
|
||||
if (layer === 0) {
|
||||
return 0; // Not expected that this is hit
|
||||
} else if (layer === 1) {
|
||||
return Math.round(144 * bitrate / (sampleRate << lowSamplingFrequency)) + padding;
|
||||
return Math.floor(144 * bitrate / (sampleRate << lowSamplingFrequency)) + padding;
|
||||
} else if (layer === 2) {
|
||||
return Math.round(144 * bitrate / sampleRate) + padding;
|
||||
return Math.floor(144 * bitrate / sampleRate) + padding;
|
||||
} else { // layer === 3
|
||||
return (Math.round(12 * bitrate / sampleRate) + padding) * 4;
|
||||
return (Math.floor(12 * bitrate / sampleRate) + padding) * 4;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user