Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error {
Show 18 variants PlaylistNotUtf8(Utf8Error), PlaylistParse(Error), UnrequestedResource { id: ResourceId, }, InitNotYetAvailable { id: ResourceId, }, Demux { id: ResourceId, source: Error, }, NotFragmented { id: ResourceId, }, NotMedia { id: ResourceId, }, InitUndecodable, ByteRangeOverflow { url: String, offset: u64, length: u64, }, DuplicateResource { id: ResourceId, }, MediaSequenceOverflow { media_sequence: u64, segments: usize, }, NoSuchVariant { index: usize, }, BadKeyLength { id: KeyId, len: usize, }, UnrequestedKey { id: KeyId, }, DecryptFailed { id: ResourceId, key_id: KeyId, }, UnsupportedEncryption { method: EncryptionMethod, what: &'static str, }, PendingKeyedOverflow { dropped: ResourceId, }, DeltaNotMergeable { media_sequence: u64, skipped_segments: u64, },
}
Expand description

Error variants crate::client::HlsClient can return.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

PlaylistNotUtf8(Utf8Error)

The playlist bytes fed to crate::client::HlsClient::on_playlist are not valid UTF-8 (RFC 8216 §4.1 playlists are UTF-8 text).

§

PlaylistParse(Error)

broadcast_hls::MediaPlaylist::parse rejected the playlist text (a known tag with a missing/unparsable required attribute).

§

UnrequestedResource

crate::client::HlsClient::on_resource was fed bytes for a crate::client::ResourceId the client never requested (a caller/driver bug, or a stale/duplicate delivery after the client already moved past it).

Fields

§id: ResourceId

The unexpected id.

§

InitNotYetAvailable

Defensive-only: a Part/Segment reached the demux step with no init segment cached. In normal operation this cannot happen — crate::client::HlsClient::on_resource buffers any Part/Segment that arrives before the init segment and replays it once the init is delivered, so callers may complete fetches in any order.

Fields

§id: ResourceId

The id that could not be demuxed yet.

§

Demux

Demuxing the concatenation of the init segment + a fetched Part/Segment resource (via transmux::Fmp4Demux) failed.

Fields

§id: ResourceId

The id whose bytes failed to demux.

§source: Error

The underlying transmux error.

§

NotFragmented

A segment of an fMP4 playlist is a progressive movie (moov, no moof): HLS fMP4 segments carry movie fragments (RFC 8216 §3.3), so no sample can be taken from it.

Fields

§id: ResourceId

The id whose bytes are a progressive MP4.

§

NotMedia

A fetched Part/Segment answered with bytes that are not media for its container: for MPEG-TS (ISO/IEC 13818-1 §2.4.3.2) no sync-byte lattice, for ISO BMFF (ISO/IEC 14496-12 §8.8.4) no complete moof followed by its mdat. The resource is marked unrequested, so a retry (crate::client::HlsClient::retry_resource or the next playlist) fetches it again. Structurally valid media that yields no samples is not this error.

Fields

§id: ResourceId

The id whose bytes are not media.

§

InitUndecodable

A fetched Media Initialization Section holds no moov box (it is not an ISO BMFF init at all, or it is truncated). The init is marked failed, so crate::client::HlsClient::retry_init fetches it again.

§

ByteRangeOverflow

An EXT-X-BYTERANGE (or EXT-X-PRELOAD-HINT byte range, RFC 8216bis §4.4.4.9/§4.4.5.3) offset + length overflowed u64. Both values come straight from the remote origin’s playlist text — broadcast_hls::MediaPlaylist::parse places no upper bound on either (confirmed: it is a bare str::parse::<u64>()) — so a malicious or corrupt origin can advertise e.g. BYTERANGE:18446744073709551615@0, or a chain of omitted-offset ranges whose per-URL running cursor (crate::client::HlsClient’s byte_range_cursor) accumulates past u64::MAX. Rejected outright rather than saturating: a saturated range would silently become a different, wrong byte range, and the client would demux whatever bytes the origin happened to return for it — a worse outcome than simply failing this one fetch.

Fields

§url: String

The resolved resource URL the range applies to.

§offset: u64

The range’s starting offset (explicit, or the carried-forward cursor for this URL).

§length: u64

The range’s length, as advertised by the playlist.

§

DuplicateResource

crate::client::HlsClient::on_resource was fed a second delivery of a crate::client::ResourceId it has already accepted (for example a driver retry racing a slow success). Rejected so a part’s samples are never emitted twice and the outstanding-fetch count never drifts (the Output exactly-once contract).

Fields

§id: ResourceId

The id delivered twice.

§

MediaSequenceOverflow

#EXT-X-MEDIA-SEQUENCE plus the playlist’s segment count overflows u64 (RFC 8216 §4.3.3.2 puts no upper bound on the tag’s value, so a hostile or corrupt origin can advertise one). Rejected outright rather than wrapping the derived Media Sequence Numbers.

Fields

§media_sequence: u64

The playlist’s EXT-X-MEDIA-SEQUENCE.

§segments: usize

The number of closed segments the playlist lists.

§

NoSuchVariant

crate::client::HlsClient::select_variant named a variant index that does not exist, or was called before any master playlist had been seen.

Fields

§index: usize

The requested index.

§

BadKeyLength

crate::client::HlsClient::on_key was fed bytes that are not exactly one AES-128 key (RFC 8216 §5.1: a key file is 16 octets).

Fields

§id: KeyId

The key whose response was the wrong size.

§len: usize

The number of bytes received.

§

UnrequestedKey

crate::client::HlsClient::on_key was fed a super::action::KeyId the client never assigned, or one whose key it already holds.

Fields

§id: KeyId

The unexpected id.

§

DecryptFailed

A segment could not be AES-128 decrypted (ciphertext not a positive multiple of 16 bytes, or invalid PKCS7 padding — e.g. the wrong key).

Fields

§id: ResourceId

The segment that failed to decrypt.

§key_id: KeyId

The key it was decrypted with.

§

UnsupportedEncryption

The playlist uses an encryption this client does not decrypt. The segment is never passed through as plaintext.

Fields

§method: EncryptionMethod

The METHOD of the key that applies.

§what: &'static str

What is unsupported.

§

PendingKeyedOverflow

Encrypted segments waiting for their key exceeded the buffering cap; the oldest was dropped and will be requested again by a later reload.

Fields

§dropped: ResourceId

The ciphertext that was dropped.

§

DeltaNotMergeable

A delta playlist (EXT-X-SKIP) could not be merged into a full view, so none of its segments was processed; a full playlist has been requested instead.

Fields

§media_sequence: u64

The delta’s EXT-X-MEDIA-SEQUENCE.

§skipped_segments: u64

Its EXT-X-SKIP SKIPPED-SEGMENTS.

Trait Implementations§

Source§

impl Clone for Error

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Error

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Error

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for Error

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for TokioError

Available on crate feature tokio only.
Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Utf8Error> for Error

Source§

fn from(source: Utf8Error) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Error

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Error

Auto Trait Implementations§

§

impl Forget for Error

§

impl Freeze for Error

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

§

impl UnwindSafe for Error

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DescriptorObject for T
where T: Debug + Any + Send + Sync,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Borrow as &dyn Any so the caller can downcast to the concrete type.
Source§

impl<T> ExtensionObject for T
where T: Debug + Any + Send + Sync,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Borrow as &dyn Any so the caller can downcast to the concrete type.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> TableObject for T
where T: Debug + Any + Send + Sync,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Borrow as &dyn Any so the caller can downcast to the concrete type.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more