Open DeusExLibris opened 8 years ago
I'll review this more in depth in a bit. For now, can you convert the tabs to 4 space indentation? Thanks!
Done - let me know if I missed anything
BTW, my original description of the issue - if you didn't see it - is here: https://github.com/audiocogs/mp3.js/issues/18
I just discovered a related issue. If the audio is being streamed and the first block of data contains only the ID3 header, MP3Demuxer.probe fails even when it receives a valid ID3 header as it tries to read the first frame and it hasn't been received yet. I am working on a fix for this as well.
These updates fix an issue where Layer3#decode would drop the last frame when no next frame is available in the stream. This situation has the most impact if the audio stream is live - that is, taken from a live source. In this case, the aurora would receive the first chunk of audio - for example, four frames - and proceed to decode them. Four mp3 frames represents roughly 100msec of audio (depending on the sample rate) and takes roughly 20 msec to decode (depending on system capacity). In this instance, additional audio frames won't be received for roughly 100msec, so when Layer3#decode tries to reference the next frame while decoding the last frame in the chunk, it doesn't exist. Previously, this would cause an exception and jump out of mp3.js back to the try/catch in decoder#decode and consequently drop that last frame.