Giter Site home page Giter Site logo

Comments (2)

pdeljanov avatar pdeljanov commented on May 13, 2024

There is no dedicated "no more packets" error since for some supported formats there is no practical distinction between an EOF condition and when we've read all the packets. For example: MP3, there is no actual defined duration and therefore nothing to check if we reached the end other than just failing to read more data from the file/source.

So this is expected behaviour. The descriptive text for the UnexpectedEof should read "end of stream". If there is an actual problem with your files you will get some kind of DecodeError with a detailed message as to what the issue is.

from symphonia.

VillSnow avatar VillSnow commented on May 13, 2024

@pdeljanov

umm, interesting.. I haven't known that mp3 might not have any sentinel or total record size.

However, this kind of EOF occurs everytime files are decoded and have to distinguished from other IO errors.
Probably this is the most strict check. Very complicated and still not clear if this is perfect.

let packet = match format.next_packet() {
    Ok(packet_ok) => packet_ok,
    Err(Error::IoError(ref packet_err))
        if packet_err.kind() == std::io::ErrorKind::UnexpectedEof =>
    {
        println!("complete!");
        break;
    }
    Err(packet_err) => panic!("{:?}", packet_err),
};

I prefer like this. I know adding enum item is incompatible change and not easy to do that. So it's just a suggestion.

let packet = match format.next_packet() {
    Ok(packet_ok) => packet_ok,
    Err(Error::EndOfStream)
    {
        println!("complete!");
        break;
    }
    Err(packet_err) => panic!("{:?}", packet_err),
};

from symphonia.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.