zhuker / lamejs

mp3 encoder in javascript
Other
820 stars 200 forks source link

Mp3's LAME Version Code is wrong #67

Open xiangyuecn opened 4 years ago

xiangyuecn commented 4 years ago

Problem

The LAME information of the encoded MP3 file is garbled.

Bad data (MP3 HEX):

//LAME????????
4C 41 4D 45 03 00 09 08 00 04

Data that should have appeared:

//LAME3.98.4
4C 41 4D 45 33 2E 39 38 2E 34

How to solve

All charAt should be replaced with charCodeAt, because character selection Java and JS are different.

Major impact codes: https://github.com/zhuker/lamejs/blob/0ae7a4a86bf671a025d1e68aede9cf9932fbe059/src/js/BitStream.js#L201

charCodeAt should be used.