rodio icon indicating copy to clipboard operation
rodio copied to clipboard

Panic when decoding mp3 file

Open a1phyr opened this issue 3 years ago • 9 comments

I tried to read the following mp3 file: silence.zip.

With rodio 0.14 it works as expected but rodio 0.15 panics when calling Decoder::new_mp3.

I used the following code to read it:

fn main() {
    let data = std::io::Cursor::new(include_bytes!("silence.mp3"));
    assert!(rodio::decoder::Decoder::new_mp3(data).is_ok());
}

a1phyr avatar Jan 31 '22 08:01 a1phyr

Can you share the backtrace? Is this with minimp3 or symphonia?

est31 avatar Jan 31 '22 12:01 est31

The panic only happens with minimp3, not symphonia.

Sorry for forgetting the backtrace, here it is:

Backtrace

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Eof', /home/alphyr/.cargo/registry/src/github.com-1ecc6299db9ec823/rodio-0.15.0/src/decoder/mp3.rs:26:50
stack backtrace:
   0: rust_begin_unwind
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:498:5
   1: core::panicking::panic_fmt
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/panicking.rs:107:14
   2: core::result::unwrap_failed
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/result.rs:1613:5
   3: core::result::Result<T,E>::unwrap
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/result.rs:1295:23
   4: rodio::decoder::mp3::Mp3Decoder<R>::new
             at /home/alphyr/.cargo/registry/src/github.com-1ecc6299db9ec823/rodio-0.15.0/src/decoder/mp3.rs:26:29
   5: rodio::decoder::Decoder<R>::new_mp3
             at /home/alphyr/.cargo/registry/src/github.com-1ecc6299db9ec823/rodio-0.15.0/src/decoder/mod.rs:163:15
   6: rodio_bug::main
             at ./src/main.rs:3:13
   7: core::ops::function::FnOnce::call_once
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

a1phyr avatar Jan 31 '22 13:01 a1phyr

Interesting, that code wasn't touched in the update. Maybe a git bisection would help?

est31 avatar Jan 31 '22 17:01 est31

@a1phyr can you add rodio as a git dependency and then do a manual git bisection as in, try out the middle commit between the two releases, then continue halving your search area?

est31 avatar Jan 31 '22 17:01 est31

Actually this commit added the failing unwrap.

A quick test shows that the panic didn't happen before

a1phyr avatar Feb 12 '22 15:02 a1phyr

Oh that's interesting. And before it's not returning an erorr but instead does playback just fine? Indeed, an unwrap is not good.

est31 avatar Feb 12 '22 15:02 est31

Yes, it does (reading it returns all 0).

a1phyr avatar Feb 12 '22 17:02 a1phyr

+1 on this.

Nisse43 avatar May 31 '22 18:05 Nisse43

+1 on this.

LighghtEeloo avatar Jun 18 '22 07:06 LighghtEeloo