Skip to content

Bit reservoir crossing chunk boundaries #14

@UCIS

Description

@UCIS

First of all, great job on aurora and the mp3 decoder!

I also experienced major audio glitches when using the mp3 decoder with a WebSocket data source. I suspect this happens when the bit reservoir is used, specifically when a frame uses data that is part of a frame in that was received in the previous chunk of raw data.

If I send more MP3 frames (50-100) per websocket chunk, the glitches occur less frequently. If I send one MP3 frame per websocket chunk, no audio is ever decoded. I think the bit reservoir may get lost between processing of input chunks.

I also had to comment out the "throw new Error('bad main_data_begin pointer');" line in Layer3.prototype.decode, and add some code to skip the call to decodeMainData in this case. If the exception is thrown, it seems that the bit reservoir is never filled. While the first frame (using the bit reservoir) can not be decoded, it should not be discarded because it may be needed for following frames.

This issue may be related to #5.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions