fix(rodio): avoid fixed ALSA buffer size

This commit is contained in:
vicrodh committed 2026-01-13 17:56:30 -06:00
1 parent 4c6bfe3fbc
commit b3eacf7113
1 file changed
-13
-13
View File
@@ -211,19 +211,6 @@ impl CpalDeviceExt for cpal::Device {
let error_callback = |err| eprintln!("an error occurred on output stream: {}", err);
let mut config = format.config();
#[cfg(target_os = "linux")]
{
if let SupportedBufferSize::Range { min, max } = *format.buffer_size() {
// Aim for ~400ms buffer to reduce wakeups during music playback.
let target_frames =
(config.sample_rate.0 as u64).saturating_mul(2).saturating_div(5);
let clamped = target_frames
.clamp(min as u64, max as u64)
.min(u32::MAX as u64) as u32;
config.buffer_size = BufferSize::Fixed(clamped);
}
}
match format.sample_format() {
cpal::SampleFormat::F32 => self.build_output_stream::<f32, _, _>(
&config,