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

this m4a file yields no events or errors #27

Closed
andrewrk opened this issue Aug 10, 2013 · 1 comment · Fixed by #28
Closed

this m4a file yields no events or errors #27

andrewrk opened this issue Aug 10, 2013 · 1 comment · Fixed by #28

Comments

@andrewrk
Copy link
Collaborator

File: http://superjoe.s3.amazonaws.com/temp/node-musicmetadata-broken.m4a

Test case:

var Mm = require('musicmetadata');
var fs = require('fs');
var thefile = "node-musicmetadata-broken.m4a"

var parser = new Mm(fs.createReadStream(thefile));
parser.on('metadata', function(metadata) {
  console.log("metadata", metadata);
});
parser.on('done', function(value) {
  console.log("done");
});

When this script is run, nothing is printed to stdout and no errors occur.

I'll see if I can fix it.

@andrewrk
Copy link
Collaborator Author

I stepped through to see what is happening. In id4.js,

The code gets to this point:

          if (!~CONTAINER_ATOMS.indexOf(v)) {
            // whats the num for ilst?
            cb.state = (cb.atomContainer === 'ilst') ? 2 : -1;
            return new strtok.BufferType(cb.atomLength - 8);
          }

In strtok.js, this while loop terminates:

        while (type !== DONE && type !== DEFER && bufsLen >= type.len) {

Because type is:

{ len: 8577079, get: [Function] }

And bufsLen is 1714.

After the while loop, strtok waits for more data which never comes, and the callback in id4.js is never called.

Do you know how to solve this?

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

Successfully merging a pull request may close this issue.

1 participant