g2g_core/error.rs
1#[derive(Debug, Clone, PartialEq, Eq)]
2#[non_exhaustive]
3pub enum G2gError {
4 /// Phase 1: no non-empty intersection between proposed upstream caps
5 /// and this element's supported caps.
6 CapsMismatch,
7 /// Element received a `DataFrame` before `configure_pipeline` succeeded.
8 NotConfigured,
9 /// Phase 2: caller should retry Phase 1 with the proposal returned in
10 /// `ConfigureOutcome::ReFixate`.
11 FixationFailed,
12 /// Buffer pool exhausted; transient, retry after upstream drain.
13 PoolExhausted,
14 /// A `MemoryDomain` variant was handed to an element that cannot consume it.
15 UnsupportedDomain,
16 /// Two branches of a fan-out (a tee's diamond) proposed allocation
17 /// parameters with no common memory domain, so there is no pool the shared
18 /// producer can allocate that satisfies both. The negotiation fails loud
19 /// rather than silently honouring one branch and copying for the other.
20 AllocationConflict,
21 /// Backend-specific hardware or driver failure.
22 Hardware(HardwareError),
23 /// Pipeline is shutting down; element should drain and propagate `Eos`.
24 Shutdown,
25 /// A [`CopyPolicy`](crate::copyplan::CopyPolicy) enforced on the graph was
26 /// violated: the negotiated pipeline performs more memory-domain frame copies
27 /// (device<->host or cross-device transfers of a raw buffer) than the budget
28 /// allows. Raised before any frame flows, so a pipeline that must stay
29 /// zero-copy refuses to start rather than paying the copy at runtime. Inspect
30 /// [`copy_plan`](crate::runtime::copy_plan) for the offending transfers.
31 CopyBudget,
32 /// A fan-in element refused an input added at runtime
33 /// ([`MultiInputElement::accepts_runtime_input`](crate::MultiInputElement::accepts_runtime_input)):
34 /// it has no pad for that source, so the add fails and the run continues on
35 /// the inputs it already has.
36 InputRefused,
37 /// An animated property binding (M882) does not fit the element it was
38 /// attached to: an unknown or non-animatable property name (raised at
39 /// startup, before any frame flows), or a sampled value the element refused
40 /// mid-run. The offending node and property are named on the log's runtime
41 /// category.
42 ControlBinding,
43 /// No data reached an element within the time it was given: the `watchdog`
44 /// transform's `timeout` elapsed with the stream stalled.
45 Timeout,
46}
47
48#[derive(Debug, Clone, PartialEq, Eq)]
49#[non_exhaustive]
50pub enum HardwareError {
51 /// `VkResult` code from a Vulkan call.
52 Vulkan(i32),
53 /// `errno` from a V4L2 ioctl.
54 V4l2(i32),
55 /// `wgpu` device or queue error.
56 Wgpu,
57 /// `HRESULT` from a Windows Media Foundation / COM call.
58 MediaFoundation(i32),
59 /// `CUresult` code from a CUDA Driver API call.
60 Cuda(i32),
61 /// Raw OS error code from a filesystem operation (`FileSrc` /
62 /// `FileSink`), zero when the OS reported none.
63 Io(i32),
64 /// ALSA `snd_*` return code (negative errno) from `alsasink`.
65 Alsa(i32),
66 /// PulseAudio error code (`pa_error_code_t`) from `pulsesink`.
67 PulseAudio(i32),
68 /// PipeWire / SPA failure from `pipewiresink` / `pipewiresrc`; carries a
69 /// negative errno where one is available, else -1.
70 PipeWire(i32),
71 /// MCU peripheral bus transfer failure (SPI / I2C / I2S via the
72 /// `embedded-hal` seams in `g2g-mcu`). No payload: HAL error types are
73 /// generic per implementation and the `no_std` core cannot carry them.
74 Peripheral,
75 /// Other backend-specific failure.
76 Other,
77}