#[non_exhaustive]pub enum Error {
Show 19 variants
PlaylistNotUtf8(Utf8Error),
PlaylistParse(Error),
UnrequestedResource {
id: ResourceId,
},
InitNotYetAvailable {
id: ResourceId,
},
Demux {
id: ResourceId,
source: Error,
},
NotFragmented {
id: ResourceId,
},
NotMedia {
id: ResourceId,
},
InitUndecodable,
UriResolve {
uri: String,
base: String,
reason: &'static str,
},
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
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: ResourceIdThe 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: ResourceIdThe 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: ResourceIdThe id whose bytes failed to demux.
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: ResourceIdThe 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: ResourceIdThe 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.
UriResolve
A playlist URI (segment/part/map/rendition-report) could not be resolved against the playlist’s own URL.
Fields
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
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: ResourceIdThe 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
NoSuchVariant
crate::client::HlsClient::select_variant named a variant index that
does not exist, or was called before any master playlist had been seen.
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).
UnrequestedKey
crate::client::HlsClient::on_key was fed a super::action::KeyId
the client never assigned, or one whose key it already holds.
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: ResourceIdThe segment that failed to decrypt.
UnsupportedEncryption
The playlist uses an encryption this client does not decrypt. The segment is never passed through as plaintext.
Fields
method: EncryptionMethodThe METHOD of the key that applies.
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: ResourceIdThe 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.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<Error> for TokioError
Available on crate feature tokio only.
impl From<Error> for TokioError
tokio only.