Skip to main content

Module client

Module client 

Source
Expand description

The sans-IO DASH client for static (VOD) presentations (docs/dash-runtime/DESIGN.md sections 1, 5 and 7).

Spec: ISO/IEC 23009-1:2022 5.3.2 (Periods, continuity 5.3.2.4), 5.3.9 (segment addressing, sidx 5.3.9.5.4), 5.6 (BaseURL), Annex A.9 (playback across Periods); ISO/IEC 14496-12 8.8.4 / 8.16.3 (moof/mdat, sidx). Verbatim text: private/specs-verified/dash/23009-1/.

DashClient is the hls_runtime::client::HlsClient analogue. The caller drains Actions, performs the I/O, feeds the answers back and drains Outputs: one Manifest per Period, then the Tracks and ordered Samples demuxed with transmux::Fmp4Demux. All selected AdaptationSets play on one timeline (design decision D7); Periods play back to back.

What it does, and does not:

  • Static and dynamic MPDs. A dynamic one needs a UTC clock (DashClient::set_wall_clock, UTCTiming through Action::FetchUtcTiming, or the response Date in ResponseMeta), gates every request on the segment’s availability, refreshes the MPD and reports Output::ClockSynced; see next_wake for timers.
  • fMP4/CMAF segments only; encrypted, MPEG-2 TS, WebM, subtitle and trick-mode sets are reported as Output::TrackDropped, never misplayed.
  • Retry policy is the caller’s. DashClient::on_failure classifies a failure (FailureClass); the caller owns the backoff arithmetic and calls DashClient::retry. A resource that fails DashConfig::max_segment_failures times in a row ends the presentation with Output::Fatal (the broadcast-client per-segment contract for a VOD playlist).
  • Init segments are fetched concurrently per Representation and shared by identical URL and range; sidx indexes are fetched before their Representation’s segments are planned; every request is a typed byte range when the MPD says so.
  • With DashConfig::cross_origin_urls = false every URL the MPD makes the client request must have the MPD’s origin.

No clock is read; the now_us arguments are the caller’s monotonic clock.

use dash_runtime::client::{Action, DashClient, DashConfig, PullLimits};

let mut client = DashClient::new("https://origin.example/vod/manifest.mpd", DashConfig::default(), PullLimits::default());
let Some(Action::FetchMpd { url, .. }) = client.poll(0) else { unreachable!() };
assert_eq!(url, "https://origin.example/vod/manifest.mpd");
// The MPD is requested once until the caller reports a failure and retries.
assert!(client.poll(0).is_none());

Re-exports§

pub use config::DashClockPolicy;
pub use config::DashConfig;
pub use config::DashConfigError;
pub use config::PullLimits;
pub use config::PullLimitsError;

Modules§

config
DashConfig: the DASH-specific knobs of a client session.

Structs§

AudioRendition
One selectable audio AdaptationSet.
DashClient
The sans-IO DASH client for static and dynamic presentations.
ManifestSelection
The selection made for one Period.
MpdValidators
The validators of the MPD the client holds; send them as If-None-Match and If-Modified-Since so an unchanged MPD answers 304 (IOP 4.4.4).
RepId
Client-assigned identity of one Representation in one Period. Stable for the life of the client.
ResponseMeta
An MPD response as the caller observed it.
StateSize
The sizes of a DashClient’s bookkeeping, see DashClient::state_size.
UtcId
Identity of one UTCTiming request; correlates an Action::FetchUtcTiming with the on_utc_* call that answers it.
UtcResponse
A UTCTiming response as the caller observed it.
VariantInfo
One Representation of a selectable video AdaptationSet, in the shape a host’s variant list wants (DESIGN D11).

Enums§

Action
One unit of I/O the caller performs.
DropCause
Why a set or Representation is not played.
Error
Errors returned by the client’s on_* and select_* calls.
Failure
How a fetch failed, as the caller observed it.
FailureClass
What the caller does after a failure.
FailureKind
The cause the core attributes to a counted failure.
FatalKind
Why the presentation cannot continue.
Notice
A non-fatal, once-per-session observation.
Output
One unit of output.
Rejection
Why a delivered body was rejected.
ResourceId
One fetchable resource; correlates an Action with the on_* call that delivers it.
UtcMethod
The HTTP method of a UTCTiming request.

Type Aliases§

Result
Result alias.