moq_audio/error.rs
1/// Errors returned by `moq-audio`.
2#[derive(Debug, thiserror::Error)]
3#[non_exhaustive]
4pub enum Error {
5 /// The requested configuration is outside what the codec supports, e.g. a
6 /// sample rate, channel count, or frame duration Opus can't encode. The
7 /// caller asked for something impossible; picking different settings fixes it.
8 #[error("unsupported audio configuration: {0}")]
9 Unsupported(String),
10
11 /// No audio device matched the requested selector, or the machine has no
12 /// default input. Retrying won't help until the device list changes;
13 /// `capture::devices` reports what is available.
14 #[error("audio device: {0}")]
15 Device(String),
16
17 /// The capture backend failed or delivered nothing: a denied permission, a
18 /// device that stopped mid-stream, or a host API error. The configuration may
19 /// be fine; the device or its permissions are not.
20 #[error("audio capture: {0}")]
21 Capture(String),
22
23 /// The input buffer was not aligned to the codec's frame size.
24 #[error("input buffer length {got} bytes does not match expected {expected}")]
25 Misaligned {
26 /// The buffer length received, in bytes.
27 got: usize,
28 /// The buffer length required, in bytes.
29 expected: usize,
30 },
31
32 /// Rubato resampler construction error.
33 #[error("resample construction: {0}")]
34 ResamplerConstruction(#[from] rubato::ResamplerConstructionError),
35
36 /// Rubato resampler runtime error.
37 #[error("resample: {0}")]
38 Resample(#[from] rubato::ResampleError),
39
40 /// hang catalog error.
41 #[error(transparent)]
42 Hang(#[from] hang::Error),
43
44 /// moq-mux container/transport error.
45 #[error(transparent)]
46 Mux(#[from] moq_mux::Error),
47
48 /// moq-net transport error.
49 #[error(transparent)]
50 Net(#[from] moq_net::Error),
51
52 /// Timestamp overflow.
53 #[error(transparent)]
54 TimeOverflow(#[from] moq_net::TimeOverflow),
55}