rodio
rodio copied to clipboard
Panic when decoding mp3 file
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());
}
Can you share the backtrace? Is this with minimp3
or symphonia
?
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.
Interesting, that code wasn't touched in the update. Maybe a git bisection would help?
@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?
Actually this commit added the failing unwrap
.
A quick test shows that the panic didn't happen before
Oh that's interesting. And before it's not returning an erorr but instead does playback just fine? Indeed, an unwrap is not good.
Yes, it does (reading it returns all 0
).
+1 on this.
+1 on this.