Skip to main content

smooth_runtime/
error.rs

1//! The engine's fatal outcome: [`SmoothError`].
2
3use thiserror::Error;
4
5use crate::client::ManifestFault;
6
7/// Why a [`crate::SmoothClient`] stopped for good.
8#[derive(Debug, Clone, PartialEq, Eq, Error)]
9#[non_exhaustive]
10pub enum SmoothError {
11    /// The manifest declares a `Protection` element (PlayReady/PIFF sample
12    /// encryption); decrypting it is out of scope (MS-SSTR ยง2.2.2.2).
13    #[error("manifest declares a Protection element; protected content is not supported")]
14    ManifestProtected,
15    /// A fragment carries PIFF/CENC sample-encryption boxes.
16    #[error("fragment carries sample-encryption boxes; protected content is not supported")]
17    FragmentEncrypted,
18    /// The manifest could not be used and the retry budget is spent.
19    #[error("manifest unusable after retries: {0}")]
20    Manifest(ManifestFault),
21    /// The manifest has no Video or Audio `StreamIndex` with a `QualityLevel`.
22    #[error("manifest resolves no usable video or audio stream")]
23    NoUsableStream,
24    /// A stream's chunk timeline could not be enumerated.
25    #[error("chunk timeline of stream {stream} is unusable: {reason}")]
26    Timeline {
27        /// Index of the stream in the manifest's stream order.
28        stream: usize,
29        /// The manifest parser's error, rendered.
30        reason: String,
31    },
32    /// A fragment kept failing on a static presentation.
33    #[error("fragment fetch failed (status {status:?})")]
34    Fragment {
35        /// The final HTTP status, when the failure was an HTTP one.
36        status: Option<u16>,
37    },
38    /// A track could not be described or its init segment could not be built.
39    #[error("track setup failed: {reason}")]
40    TrackSetup {
41        /// The codec-glue error, rendered.
42        reason: String,
43    },
44}