Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I have found reason why bad main_data_begin pointer happend #27

Open
dadidzf opened this issue Jul 16, 2020 · 3 comments
Open

I have found reason why bad main_data_begin pointer happend #27

dadidzf opened this issue Jul 16, 2020 · 3 comments

Comments

@dadidzf
Copy link

dadidzf commented Jul 16, 2020

var mp3Decode = AV.Decoder.find('mp3');
var readChunk = mp3Decode.prototype.readChunk
mp3Decode.prototype.readChunk = function () {
    var sync = this.mp3_stream.sync;
    var next_frame = this.mp3_stream.next_frame;
    try {
        return readChunk.bind(this)();
    }
    catch (err) {
        this.mp3_stream.sync = sync;
        this.mp3_stream.next_frame = next_frame;
        throw err;
    }
}

The above code shows how i fix the bad main_data_begin pointer issue.
The resason is because, the point (next_frame) of the mp3_stream is not reverted while catch err.
After add the code in other place, i fix that problem.

I don't know the best way to fix it, in mp3.js repository directly, so i just add the issue here.

@dadidzf dadidzf changed the title I have find reason why bad main_data_begin pointer occurs I have found reason why bad main_data_begin pointer happend Jul 16, 2020
@pschuegr
Copy link

pschuegr commented Jan 17, 2021

Hi @dadidzf, nice find! Can you explain where you put this code? I'm trying to sort out this problem too.

@pschuegr
Copy link

Never mind! I see you just have to put it in your own code before calling the AV funcs. @devongovett would you accept a PR for this?

@dadidzf
Copy link
Author

dadidzf commented Jan 18, 2021

I use Aurora.js and mp3.js together, but i didn't modify them to fix it, I put the code in my own application project. i have verify this code works fine. if we want to add PR for this, i think we should modify the function "readChunk" in src/decoder.js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants