Fix faulty MP3 bitrate and frame size calculation (fixes #134)

This commit is contained in:
Vanilagy
2025-09-19 13:20:36 +02:00
parent e88bc15b0e
commit eb1ce86187
10 changed files with 151 additions and 129 deletions
+3 -1
View File
@@ -28,7 +28,9 @@ class Mp3Encoder extends CustomAudioEncoder {
static override supports(codec: AudioCodec, config: AudioDecoderConfig): boolean {
return codec === 'mp3'
&& (config.numberOfChannels === 1 || config.numberOfChannels === 2)
&& Object.values(SAMPLING_RATES).some(x => x.includes(config.sampleRate));
&& Object.values(SAMPLING_RATES).some(x =>
x === config.sampleRate || (x / 2) === config.sampleRate || (x / 4) === config.sampleRate,
);
}
async init() {