toeverything/AFFiNE · error

Failed to create FastFixedIn resampler (5-arg attempt)

Error message

Failed to create FastFixedIn resampler (5-arg attempt)

What it means

Raised in `BufferedResampler::new` on macOS when the rubato FastFixedIn constructor rejects its arguments (non-finite or invalid ratio, zero channels, or internal allocation failure). The first construction attempt with the full 5-argument form failed; capture pipelines that need sample-rate conversion cannot be built, so audio from that device cannot be captured.

Source

Thrown at packages/frontend/native/media_capture/src/macos/utils.rs:37

struct BufferedResampler {
  resampler: FastFixedIn<f32>,
  channels: usize,
  fifo: Vec<Vec<f32>>,            // per-channel queue
  initial_output_discarded: bool, // Flag to track if the first output has been discarded
}

impl BufferedResampler {
  fn new(from_sr: f64, to_sr: f64, channels: usize) -> Self {
    let ratio = to_sr / from_sr;
    let resampler = FastFixedIn::<f32>::new(
      ratio,
      1.0,                      // max_resample_ratio_relative (must be >= 1.0, use 1.0 for fixed ratio)
      PolynomialDegree::Linear, // Use Linear interpolation quality
      RESAMPLER_INPUT_CHUNK,
      channels,
    )
    .expect("Failed to create FastFixedIn resampler (5-arg attempt)");

    BufferedResampler {
      resampler,
      channels,
      fifo: vec![Vec::<f32>::new(); channels],
      initial_output_discarded: false,
    }
  }

  // feed planar samples; returns interleaved output (may be empty if not
  // enough samples accumulated yet).
  fn feed(&mut self, planar_in: &[Vec<f32>]) -> Vec<f32> {
    // Append incoming to fifo
    for (ch, data) in planar_in.iter().enumerate() {
      self.fifo[ch].extend_from_slice(data);
    }

    let mut interleaved_out: Vec<f32> = Vec::new();

View on GitHub (pinned to b4c8548c09)

Solutions

  1. Retry with supported sample rates for the 5-arg resampler.
  2. Update the native audio dependency.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Panics in BufferedResampler::new on macOS when rubato FastFixedIn::new fails for the computed sample-rate ratio and chunk size.

Common situations: Audio capture started with an invalid or extreme sample-rate conversion ratio. Check the device sample rates reported by the audio hardware.


AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18). Data as JSON: /api/errors/6fedc99b9aa32d57. Report an issue: GitHub.