MCPcopy Create free account
hub / github.com/PerroEngine/Perro / delta_payload

Function delta_payload

perro_source/audio_stack/perro_pawdio/src/mic.rs:281–292  ·  view source on GitHub ↗
(samples: &[i16], channels: u16)

Source from the content-addressed store, hash-verified

279 ));
280 }
281 let mut samples = Vec::with_capacity(expected_samples);
282 for chunk in payload.chunks_exact(2) {
283 samples.push(i16::from_le_bytes([chunk[0], chunk[1]]));
284 }
285 Ok(samples)
286}
287
288fn checked_sample_len(frames: usize, channels: u16) -> Result<usize, String> {
289 let len = frames
290 .checked_mul(channels as usize)
291 .ok_or_else(|| "mic clip sample len overflow".to_string())?;
292 if len > PMIC_MAX_SAMPLES {
293 return Err(format!(
294 "mic clip sample len {len} exceeds limit {PMIC_MAX_SAMPLES}"
295 ));

Callers 1

packMethod · 0.85

Calls 5

write_varintFunction · 0.85
zigzag_i16Function · 0.85
maxMethod · 0.45
lenMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected