1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/// Errors returned by `moq-audio`.
///
/// `Clone` so a failure can be reported to more than one observer, matching
/// `hang::Error`, `moq_mux::Error`, and `moq_net::Error`.
#[derive(Clone, Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
/// The requested configuration is outside what the codec or device supports,
/// e.g. a sample rate, channel count, or frame duration Opus can't encode, or a
/// capture format the microphone can't deliver. The
/// caller asked for something impossible; picking different settings fixes it.
#[error("unsupported audio configuration: {0}")]
Unsupported(String),
/// No audio device matched the requested selector, or the machine has no
/// default input. Retrying won't help until the device list changes;
/// `capture::devices` reports what is available.
#[error("audio device: {0}")]
Device(String),
/// The capture backend failed or delivered nothing: a denied permission, a
/// device that stopped mid-stream, or a host API error. The configuration may
/// be fine; the device or its permissions are not.
#[error("audio capture: {0}")]
Capture(String),
/// The playback backend failed: the output device could not be opened, or the
/// stream stopped and could not be restarted. The device or host API is at
/// fault, not the configuration; `playback::devices` reports what is
/// available.
#[error("audio playback: {0}")]
Playback(String),
/// Exclusive audio processing state is already owned by another live
/// capture or playback handle.
#[error("audio resource already in use: {0}")]
Busy(String),
/// A packet could not be decoded: truncated, corrupt, or using a codec
/// feature this build doesn't implement. The stream itself may be fine, so a
/// consumer can log this one and read the next packet.
#[error("audio decode: {0}")]
Decode(String),
/// The input buffer was not aligned to the codec's frame size.
#[error("input buffer length {got} bytes does not match expected {expected}")]
Misaligned {
/// The buffer length received, in bytes.
got: usize,
/// The buffer length required, in bytes.
expected: usize,
},
/// The sample-rate converter could not be constructed.
#[error("resample construction: {0}")]
ResamplerConstruction(String),
/// The sample-rate converter rejected an input buffer or ratio change.
#[error("resample: {0}")]
Resample(String),
/// hang catalog error.
#[error(transparent)]
Hang(#[from] hang::Error),
/// moq-mux container/transport error.
#[error(transparent)]
Mux(#[from] moq_mux::Error),
/// moq-net transport error.
#[error(transparent)]
Net(#[from] moq_net::Error),
/// Timestamp overflow.
#[error(transparent)]
TimeOverflow(#[from] moq_net::TimeOverflow),
}