RustAudio/rodio

symphonia-flac panic

Initsnow opened this issue · 3 comments

I'm currently writing a third-party client for a streaming music platform. When I use rodio to play the highest quality audio, I get an error:

Details

thread 'main' panicked at src/lib.rs:154:61:
called `Result::unwrap()` on an `Err` value: IoError("end of stream")
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\std\src\panicking.rs:652
   1: core::panicking::panic_fmt
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\core\src\panicking.rs:72
   2: core::result::unwrap_failed
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\core\src\result.rs:1654
   3: enum2$<core::result::Result<rodio::decoder::Decoder<std::io::buffered::bufreader::BufReader<std::fs::File> >,enum2$<rodio::decoder::DecoderError> > >::unwrap
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081\library\core\src\result.rs:1077
   4: lib::play::Player::restart
             at .\src\lib.rs:154
   5: mruwyy::components::playbar::handle_play_action_start::async_fn$0
             at .\src\components\playbar.rs:742
   6: mruwyy::components::playbar::PlayBar::closure$3::async_block$0
             at .\src\components\playbar.rs:121
   7: dioxus_core::runtime::Runtime::handle_task_wakeup
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\dioxus-core-0.5.1\src\tasks.rs:207
   8: dioxus_core::virtual_dom::VirtualDom::render_immediate<dioxus_interpreter_js::write_native_mutations::MutationState>
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\dioxus-core-0.5.1\src\virtual_dom.rs:649
   9: dioxus_desktop::app::App::handle_user_event_msg
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\dioxus-desktop-0.5.1\src\app.rs:319
  10: dioxus_desktop::launch::launch_virtual_dom_blocking::closure$0
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\dioxus-desktop-0.5.1\src\launch.rs:55
  11: tao::platform_impl::platform::event_loop::impl$3::run_return::closure$0<enum2$<dioxus_desktop::ipc::UserWindowEvent>,dioxus_desktop::launch::launch_virtual_dom_blocking::closure_env$0>       
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\tao-0.26.2\src\platform_impl\windows\event_loop.rs:237
  12: alloc::boxed::impl$49::call_mut<tuple$<enum2$<tao::event::Event<enum2$<dioxus_desktop::ipc::UserWindowEvent> > >,ref_mut$<enum2$<tao::event_loop::ControlFlow> > >,dyn$<core::ops::function::FnMut<tuple$<enum2$<tao::event::Event<enum2$<dioxus_desktop::ipc::
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081\library\alloc\src\boxed.rs:2029
  13: tao::platform_impl::platform::event_loop::runner::impl$3::call_event_handler::closure$0<enum2$<dioxus_desktop::ipc::UserWindowEvent> >
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\tao-0.26.2\src\platform_impl\windows\event_loop\runner.rs:250
  14: core::panic::unwind_safe::impl$25::call_once<tuple$<>,tao::platform_impl::platform::event_loop::runner::impl$3::call_event_handler::closure_env$0<enum2$<dioxus_desktop::ipc::UserWindowEvent> > >
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081\library\core\src\panic\unwind_safe.rs:272
  15: std::panicking::try::do_call<core::panic::unwind_safe::AssertUnwindSafe<tao::platform_impl::platform::event_loop::runner::impl$3::call_event_handler::closure_env$0<enum2$<dioxus_desktop::ipc::UserWindowEvent> > >,tuple$<> >
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081\library\std\src\panicking.rs:559
  16: dioxus_desktop::query::_::impl$0::deserialize::impl$2::visit_map<ref_mut$<serde_json::value::de::MapDeserializer> >
  17: std::panicking::try<tuple$<>,core::panic::unwind_safe::AssertUnwindSafe<tao::platform_impl::platform::event_loop::runner::impl$3::call_event_handler::closure_env$0<enum2$<dioxus_desktop::ipc::UserWindowEvent> > > >
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081\library\std\src\panicking.rs:523
  18: std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<tao::platform_impl::platform::event_loop::runner::impl$3::call_event_handler::closure_env$0<enum2$<dioxus_desktop::ipc::UserWindowEvent> > >,tuple$<> >
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081\library\std\src\panic.rs:149
  19: tao::platform_impl::platform::event_loop::runner::EventLoopRunner<enum2$<dioxus_desktop::ipc::UserWindowEvent> >::catch_unwind<enum2$<dioxus_desktop::ipc::UserWindowEvent>,tuple$<>,tao::platform_impl::platform::event_loop::runner::impl$3::call_event_handl
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\tao-0.26.2\src\platform_impl\windows\event_loop\runner.rs:156
  20: tao::platform_impl::platform::event_loop::runner::EventLoopRunner<enum2$<dioxus_desktop::ipc::UserWindowEvent> >::call_event_handler<enum2$<dioxus_desktop::ipc::UserWindowEvent> >
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\tao-0.26.2\src\platform_impl\windows\event_loop\runner.rs:242
  21: tao::platform_impl::platform::event_loop::runner::EventLoopRunner<enum2$<dioxus_desktop::ipc::UserWindowEvent> >::send_event<enum2$<dioxus_desktop::ipc::UserWindowEvent> >
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\tao-0.26.2\src\platform_impl\windows\event_loop\runner.rs:224
  22: tao::platform_impl::platform::event_loop::ThreadMsgTargetSubclassInput<enum2$<dioxus_desktop::ipc::UserWindowEvent> >::send_event<enum2$<dioxus_desktop::ipc::UserWindowEvent> >
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\tao-0.26.2\src\platform_impl\windows\event_loop.rs:125
  23: tao::platform_impl::platform::event_loop::thread_event_target_callback::closure$0<enum2$<dioxus_desktop::ipc::UserWindowEvent> >
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\tao-0.26.2\src\platform_impl\windows\event_loop.rs:2296
  24: core::ops::function::FnOnce::call_once<tao::platform_impl::platform::event_loop::thread_event_target_callback::closure_env$0<enum2$<dioxus_desktop::ipc::UserWindowEvent> >,tuple$<> >
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081\library\core\src\ops\function.rs:250
  25: core::panic::unwind_safe::impl$25::call_once<windows::Win32::Foundation::LRESULT,tao::platform_impl::platform::event_loop::thread_event_target_callback::closure_env$0<enum2$<dioxus_desktop::ipc::UserWindowEvent> > >
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081\library\core\src\panic\unwind_safe.rs:272
  26: std::panicking::try::do_call<core::panic::unwind_safe::AssertUnwindSafe<tao::platform_impl::platform::event_loop::thread_event_target_callback::closure_env$0<enum2$<dioxus_desktop::ipc::UserWindowEvent> > >,windows::Win32::Foundation::LRESULT>
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081\library\std\src\panicking.rs:559
  27: dioxus_desktop::query::_::impl$0::deserialize::impl$2::visit_map<ref_mut$<serde_json::value::de::MapDeserializer> >
  28: std::panicking::try<windows::Win32::Foundation::LRESULT,core::panic::unwind_safe::AssertUnwindSafe<tao::platform_impl::platform::event_loop::thread_event_target_callback::closure_env$0<enum2$<dioxus_desktop::ipc::UserWindowEvent> > > >
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081\library\std\src\panicking.rs:523
  29: std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<tao::platform_impl::platform::event_loop::thread_event_target_callback::closure_env$0<enum2$<dioxus_desktop::ipc::UserWindowEvent> > >,windows::Win32::Foundation::LRESULT>
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081\library\std\src\panic.rs:149
  30: tao::platform_impl::platform::event_loop::runner::EventLoopRunner<enum2$<dioxus_desktop::ipc::UserWindowEvent> >::catch_unwind<enum2$<dioxus_desktop::ipc::UserWindowEvent>,windows::Win32::Foundation::LRESULT,tao::platform_impl::platform::event_loop::threa
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\tao-0.26.2\src\platform_impl\windows\event_loop\runner.rs:156
  31: tao::platform_impl::platform::event_loop::thread_event_target_callback<enum2$<dioxus_desktop::ipc::UserWindowEvent> >
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\tao-0.26.2\src\platform_impl\windows\event_loop.rs:2345
  32: DefSubclassProc
  33: DefSubclassProc
  34: DispatchMessageW
  35: DispatchMessageW
  36: windows::Win32::UI::WindowsAndMessaging::DispatchMessageW
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\windows-0.54.0\src\Windows\Win32\UI\WindowsAndMessaging\mod.rs:764
  37: tao::platform_impl::platform::event_loop::EventLoop<enum2$<dioxus_desktop::ipc::UserWindowEvent> >::run_return<enum2$<dioxus_desktop::ipc::UserWindowEvent>,dioxus_desktop::launch::launch_virtual_dom_blocking::closure_env$0>
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\tao-0.26.2\src\platform_impl\windows\event_loop.rs:259
  38: tao::platform_impl::platform::event_loop::EventLoop<enum2$<dioxus_desktop::ipc::UserWindowEvent> >::run<enum2$<dioxus_desktop::ipc::UserWindowEvent>,dioxus_desktop::launch::launch_virtual_dom_blocking::closure_env$0>
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\tao-0.26.2\src\platform_impl\windows\event_loop.rs:221
  39: tao::event_loop::EventLoop<enum2$<dioxus_desktop::ipc::UserWindowEvent> >::run<enum2$<dioxus_desktop::ipc::UserWindowEvent>,dioxus_desktop::launch::launch_virtual_dom_blocking::closure_env$0>
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\tao-0.26.2\src\event_loop.rs:211
  40: dioxus_desktop::launch::launch_virtual_dom_blocking
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\dioxus-desktop-0.5.1\src\launch.rs:17
  41: dioxus_desktop::launch::launch_virtual_dom::async_block$0
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\dioxus-desktop-0.5.1\src\launch.rs:76
  42: tokio::task::unconstrained::impl$0::poll::closure$0<enum2$<dioxus_desktop::launch::launch_virtual_dom::async_block_env$0> >
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\tokio-1.38.0\src\task\unconstrained.rs:25
  43: tokio::runtime::coop::with_budget
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\tokio-1.38.0\src\runtime\coop.rs:107
  44: tokio::runtime::coop::with_unconstrained
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\tokio-1.38.0\src\runtime\coop.rs:80
  45: tokio::task::unconstrained::impl$0::poll<enum2$<dioxus_desktop::launch::launch_virtual_dom::async_block_env$0> >
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\tokio-1.38.0\src\task\unconstrained.rs:25
  46: tokio::runtime::park::impl$4::block_on::closure$0<tokio::task::unconstrained::Unconstrained<enum2$<dioxus_desktop::launch::launch_virtual_dom::async_block_env$0> > >
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\tokio-1.38.0\src\runtime\park.rs:281
  47: tokio::runtime::coop::with_budget
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\tokio-1.38.0\src\runtime\coop.rs:107
  48: tokio::runtime::coop::budget
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\tokio-1.38.0\src\runtime\coop.rs:73
  49: tokio::runtime::park::CachedParkThread::block_on<tokio::task::unconstrained::Unconstrained<enum2$<dioxus_desktop::launch::launch_virtual_dom::async_block_env$0> > >
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\tokio-1.38.0\src\runtime\park.rs:281
  50: tokio::runtime::context::blocking::BlockingRegionGuard::block_on<tokio::task::unconstrained::Unconstrained<enum2$<dioxus_desktop::launch::launch_virtual_dom::async_block_env$0> > >
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\tokio-1.38.0\src\runtime\context\blocking.rs:66
  51: tokio::runtime::scheduler::multi_thread::impl$0::block_on::closure$0<tokio::task::unconstrained::Unconstrained<enum2$<dioxus_desktop::launch::launch_virtual_dom::async_block_env$0> > >       
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\tokio-1.38.0\src\runtime\scheduler\multi_thread\mod.rs:87
  52: tokio::runtime::context::runtime::enter_runtime<tokio::runtime::scheduler::multi_thread::impl$0::block_on::closure_env$0<tokio::task::unconstrained::Unconstrained<enum2$<dioxus_desktop::launch::launch_virtual_dom::async_block_env$0> > >,tuple$<> >
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\tokio-1.38.0\src\runtime\context\runtime.rs:65
  53: tokio::runtime::scheduler::multi_thread::MultiThread::block_on<tokio::task::unconstrained::Unconstrained<enum2$<dioxus_desktop::launch::launch_virtual_dom::async_block_env$0> > >
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\tokio-1.38.0\src\runtime\scheduler\multi_thread\mod.rs:86
  54: tokio::runtime::runtime::Runtime::block_on<tokio::task::unconstrained::Unconstrained<enum2$<dioxus_desktop::launch::launch_virtual_dom::async_block_env$0> > >
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\tokio-1.38.0\src\runtime\runtime.rs:349
  55: dioxus_desktop::launch::launch_virtual_dom
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\dioxus-desktop-0.5.1\src\launch.rs:71
  56: dioxus_desktop::launch::launch
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\dioxus-desktop-0.5.1\src\launch.rs:95
  57: dioxus::launch::LaunchBuilder<dioxus_desktop::config::Config,dyn$<core::ops::function::Fn<tuple$<>,assoc$<Output,alloc::boxed::Box<dyn$<core::any::Any>,alloc::alloc::Global> > > > >::launch<dioxus_desktop::config::Config,dyn$<core::ops::function::Fn<tuple
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\dioxus-0.5.1\src\launch.rs:171
  58: dioxus::launch::launch
             at E:\packages\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-2eab394af869c8a2\dioxus-0.5.1\src\launch.rs:280
  59: mruwyy::main
             at .\src\main.rs:98
  60: core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081\library\core\src\ops\function.rs:250
  61: core::hint::black_box
             at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081\library\core\src\hint.rs:338
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

code here: let source = Decoder::new(BufReader::new(file)).unwrap();
ffprobe result:

  libavutil      59.  8.100 / 59.  8.100
  libavcodec     61.  3.100 / 61.  3.100
  libavformat    61.  1.100 / 61.  1.100
  libavdevice    61.  1.100 / 61.  1.100
  libavfilter    10.  1.100 / 10.  1.100
  libswscale      8.  1.100 /  8.  1.100
  libswresample   5.  1.100 /  5.  1.100
  libpostproc    58.  1.100 / 58.  1.100
Input #0, flac, from '2097486092.flac':
  Metadata:
    encoder         : Lavf58.45.100
  Duration: 00:04:26.41, start: 0.000000, bitrate: 5206 kb/s
  Stream #0:0: Audio: flac, 192000 Hz, stereo, s32 (24 bit)

audio file link

I used the symphonia-flac feature because I want to seek in flac files. But it can't play the 'highest' audio, but default decoder can work fine

It could be an issue in symphonia. Can you see if it plays using the symphonia play example and report back?

It could be an issue in symphonia. Can you see if it plays using the symphonia play example and report back?

It looks like this problem is caused by symphonia

.\symphonia-play.exe 'C:\Users\Initsnow\AppData\Local\mruwyy\2097486092.flac'
 ERROR symphonia_play > end of stream

Maybe I shoud submit a new issue in symphonia repository

Thanks for narrowing it down 👍

Maybe I shoud submit a new issue in symphonia repository

Since the file plays fine in other software (like vlc/audacity etc) its a bug in Symphonia. Making an issue in the symphonia repository is there is the next thing to do.