cpal icon indicating copy to clipboard operation
cpal copied to clipboard

thread 'cpal_alsa_out' panicked at 'capacity overflow'

Open Sondeluz opened this issue 4 years ago • 2 comments

I am playing small tracks of audio (.mp3 and .wav files), with this code inside a thread, using the Rodio library:

let (_stream, stream_handle) = OutputStream::try_default().unwrap();
let sink = Sink::try_new(&stream_handle).unwrap();
let file = BufReader::new(File::open(path).unwrap());

let source = Decoder::new(file).unwrap();

sink.append(source);
  
sink.sleep_until_end();

While on my PC (x86_64) it works perfectly, attempting to run the same code in my raspberry pi zero (armv6) results in the following panic no matter what I do:


thread 'cpal_alsa_out' panicked at 'capacity overflow', library/alloc/src/raw_vec.rs:559:5
stack backtrace:
   0: rust_begin_unwind
             at /rustc/8b87e85394aa583b01e53aef06343dd0749a3324/library/std/src/panicking.rs:515:5
   1: core::panicking::panic_fmt
             at /rustc/8b87e85394aa583b01e53aef06343dd0749a3324/library/core/src/panicking.rs:92:14
   2: core::panicking::panic
             at /rustc/8b87e85394aa583b01e53aef06343dd0749a3324/library/core/src/panicking.rs:50:5
   3: alloc::raw_vec::capacity_overflow
             at /rustc/8b87e85394aa583b01e53aef06343dd0749a3324/library/alloc/src/raw_vec.rs:559:5
   4: alloc::raw_vec::RawVec<T,A>::reserve::do_reserve_and_handle
   5: cpal::host::alsa::poll_descriptors_and_prepare_buffer
   6: cpal::host::alsa::output_stream_worker
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

The pi zero is running raspbian/debian with alsa and libasound2-plugins working correctly.

I'm not really sure whether this should go to Rodio or here.

Please let me know if I can do anything to help!

Sondeluz avatar Jul 09 '21 16:07 Sondeluz

I'm having the same issue on a pi zero. Any solution?

nck974 avatar Nov 04 '23 13:11 nck974