Skip to main content

moq_video/
error.rs

1/// Errors returned by `moq-video`.
2#[derive(Debug, thiserror::Error)]
3#[non_exhaustive]
4pub enum Error {
5	/// No encoder matching the requested codec / hardware preference could be
6	/// opened (none compiled in, or none available on this machine).
7	#[error("no usable video encoder found (tried: {0})")]
8	NoEncoder(String),
9
10	/// No decoder matching the requested codec / hardware preference could be
11	/// opened (none compiled in, or none available on this machine).
12	#[error("no usable video decoder found (tried: {0})")]
13	NoDecoder(String),
14
15	/// A track's codec is not supported by the native decoders.
16	#[error("unsupported codec for native decode: {0}")]
17	UnsupportedCodec(String),
18
19	/// The requested capture source or enumeration has no implementation on this
20	/// platform (the message names what is missing).
21	#[error("not supported on this platform: {0}")]
22	Unsupported(String),
23
24	/// The operating system denied access to a capture source.
25	#[error("capture permission denied: {0}")]
26	PermissionDenied(String),
27
28	/// A requested capture source does not exist or disappeared while capturing.
29	#[error("capture source unavailable: {0}")]
30	SourceUnavailable(String),
31
32	/// The configured framerate is outside the supported range.
33	#[error("invalid framerate: {0} (must be between 1 and 1,000,000)")]
34	InvalidFramerate(u32),
35
36	/// This encoder can't change its bitrate once open, so it can't follow a
37	/// congestion-control estimate. Encoding continues at the configured rate.
38	#[error("encoder {0} cannot change bitrate while running")]
39	BitrateUnsupported(&'static str),
40
41	/// GPU rendering failure: building the pipeline, importing a frame's surface
42	/// as a texture, or the device itself.
43	#[error("render: {0}")]
44	Render(#[source] anyhow::Error),
45
46	/// Capture / encode / codec failure (the message carries the detail).
47	#[error(transparent)]
48	Codec(#[from] anyhow::Error),
49
50	/// moq-mux muxer/catalog error.
51	#[error(transparent)]
52	Mux(#[from] moq_mux::Error),
53
54	/// moq-net transport error.
55	#[error(transparent)]
56	Net(#[from] moq_net::Error),
57
58	/// Timestamp overflow converting to the moq microsecond timescale.
59	#[error(transparent)]
60	TimeOverflow(#[from] moq_net::TimeOverflow),
61}