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 configured framerate was zero (would divide by zero / produce a
25	/// degenerate codec time base).
26	#[error("invalid framerate: {0} (must be non-zero)")]
27	InvalidFramerate(u32),
28
29	/// This encoder can't change its bitrate once open, so it can't follow a
30	/// congestion-control estimate. Encoding continues at the configured rate.
31	#[error("encoder {0} cannot change bitrate while running")]
32	BitrateUnsupported(&'static str),
33
34	/// Capture / encode / codec failure (the message carries the detail).
35	#[error(transparent)]
36	Codec(#[from] anyhow::Error),
37
38	/// moq-mux muxer/catalog error.
39	#[error(transparent)]
40	Mux(#[from] moq_mux::Error),
41
42	/// moq-net transport error.
43	#[error(transparent)]
44	Net(#[from] moq_net::Error),
45
46	/// Timestamp overflow converting to the moq microsecond timescale.
47	#[error(transparent)]
48	TimeOverflow(#[from] moq_net::TimeOverflow),
49}