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

"buffer underrun" when reading m4a file #311

Open
zhaih opened this issue Aug 18, 2024 · 1 comment
Open

"buffer underrun" when reading m4a file #311

zhaih opened this issue Aug 18, 2024 · 1 comment

Comments

@zhaih
Copy link

zhaih commented Aug 18, 2024

Hi there, I'm using following code to read a file

    let file = Box::new(File::open(Path::new(filename)).unwrap());

    let mss = MediaSourceStream::new(file, Default::default());

    let hint = Hint::new();

    let format_opts: FormatOptions = Default::default();
    let metadata_opts: MetadataOptions = Default::default();

    let probed = symphonia::default::get_probe()
        .format(&hint, mss, &format_opts, &metadata_opts)             <--- error thrown this line
        .unwrap();

    probed.format

And got this error

called `Result::unwrap()` on an `Err` value: IoError(Custom { kind: UnexpectedEof, error: "buffer underrun" })

After some research I found it should be thrown from BufReader, but I don't know what it is reading when throwing this error, please help take a look. I would probably also try to attach a debugger to see what's going on later maybe. I could also share the audio file but since it's purchased so I guess better share it privately.

@zhaih
Copy link
Author

zhaih commented Aug 20, 2024

Ok, I think it's because the genre tag is written in an invalid format, it's expecting an u16 number but the file somehow stored a utf-8 space charactor. But still I think there might be some room of improvement:

  1. Maybe we should ignore the invalid input as long as it doesn't affect actual data integrity?
  2. maybe we can add better debug info on where it fails, rather than having to attach the debugger?

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

1 participant