Skip to main content

SmoothOrigin

Struct SmoothOrigin 

Source
pub struct SmoothOrigin { /* private fields */ }
Available on crate feature std only.
Expand description

The live Smooth origin over one Trunk.

Implementations§

Source§

impl SmoothOrigin

Source

pub fn new(config: SmoothOriginConfig) -> Self

An origin over config.trunk; it describes whatever segments the trunk currently holds, once an init segment is stored and at least one track is announced.

Source

pub fn trunk(&self) -> &Arc<Trunk> ⓘ

The Trunk this origin reads.

Source

pub fn stream_keys(&self) -> Vec<StreamKey>

The streams this origin currently advertises, in manifest order — the vocabulary SmoothRequest::parse needs to read a request path. Empty while the trunk has nothing to describe.

Source

pub fn set_init(&self, bytes: impl Into<Bytes>)

Store the fMP4 init segment the trunk’s segments are muxed with — the one thing no Trunk ring holds, and what a fragment request is re-demuxed against. Storing the segment already held changes nothing, so a host may call this on every request without invalidating the cached plan.

Source

pub fn init(&self) -> Option<Bytes>

The init segment currently stored, if any.

Source

pub fn fragments(&self) -> Result<Vec<FragmentLocation>, SmoothOriginError>

The fragments currently advertised, in manifest order, or None while the trunk has nothing to advertise yet.

Source

pub fn manifest( &self, now: Timestamp, await_policy: AwaitPolicy, ) -> EgressResponse<String>

Render the live client Manifest, or why it cannot be rendered yet (EgressResponse::Await) or at all (EgressResponse::BadRequest).

Trait Implementations§

Source§

impl ServedEgress for SmoothOrigin

Source§

type Request = SmoothRequest

The protocol-specific request shape (e.g. LL-HLS’s Media Sequence Number + part index; a DASH segment/manifest request; a catch-up time range) — owned by the implementing crate, not this one.
Source§

type Body = SmoothBody

The protocol-specific resolved body (a playlist string, manifest XML, segment bytes, …).
Source§

fn resolve( &self, request: SmoothRequest, now: Timestamp, await_policy: AwaitPolicy, ) -> EgressResponse<SmoothBody>

Resolve request against this implementation’s current state at time now, bounded by await_policy — see EgressResponse::Await’s contract.
Source§

fn is_warm(&self, request: &SmoothRequest) -> bool

true when resolveing request now is cheap: no scan, demux or packaging is left to do. An implementation that has such work answers false until prepare has run, so an async host can do that work on a blocking thread rather than on the worker that woke the request. The default is always warm.
Source§

fn prepare(&self, request: SmoothRequest)

Do the heavy work request needs so that the next resolve is warm. Blocking and CPU-bound; call it on a thread that may block. The default does nothing.

Auto Trait Implementations§

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<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, 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<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