{"record":{"id":"6fedc99b9aa32d57","repo":"toeverything/AFFiNE","slug":"failed-to-create-fastfixedin-resampler-5-arg-atte","errorCode":null,"errorMessage":"Failed to create FastFixedIn resampler (5-arg attempt)","messagePattern":"Failed to create FastFixedIn resampler \\(5-arg attempt\\)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/frontend/native/media_capture/src/macos/utils.rs","lineNumber":37,"sourceCode":"\nstruct BufferedResampler {\n  resampler: FastFixedIn<f32>,\n  channels: usize,\n  fifo: Vec<Vec<f32>>,            // per-channel queue\n  initial_output_discarded: bool, // Flag to track if the first output has been discarded\n}\n\nimpl BufferedResampler {\n  fn new(from_sr: f64, to_sr: f64, channels: usize) -> Self {\n    let ratio = to_sr / from_sr;\n    let resampler = FastFixedIn::<f32>::new(\n      ratio,\n      1.0,                      // max_resample_ratio_relative (must be >= 1.0, use 1.0 for fixed ratio)\n      PolynomialDegree::Linear, // Use Linear interpolation quality\n      RESAMPLER_INPUT_CHUNK,\n      channels,\n    )\n    .expect(\"Failed to create FastFixedIn resampler (5-arg attempt)\");\n\n    BufferedResampler {\n      resampler,\n      channels,\n      fifo: vec![Vec::<f32>::new(); channels],\n      initial_output_discarded: false,\n    }\n  }\n\n  // feed planar samples; returns interleaved output (may be empty if not\n  // enough samples accumulated yet).\n  fn feed(&mut self, planar_in: &[Vec<f32>]) -> Vec<f32> {\n    // Append incoming to fifo\n    for (ch, data) in planar_in.iter().enumerate() {\n      self.fifo[ch].extend_from_slice(data);\n    }\n\n    let mut interleaved_out: Vec<f32> = Vec::new();","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/frontend/native/media_capture/src/macos/utils.rs#L19-L55","documentation":"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.","triggerScenarios":"Panics in BufferedResampler::new on macOS when rubato FastFixedIn::new fails for the computed sample-rate ratio and chunk size.","commonSituations":"Audio capture started with an invalid or extreme sample-rate conversion ratio. Check the device sample rates reported by the audio hardware.","solutions":["Retry with supported sample rates for the 5-arg resampler.","Update the native audio dependency."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b4c8548c09da21b2898443559a5b846f0ccf5dd8","analyzedAt":"2026-08-18T21:16:52.546Z","contentChangedAt":"2026-08-18T21:16:52.546Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}