Skip to main content

Snapshot

Struct Snapshot 

Source
#[non_exhaustive]
pub struct Snapshot { pub streams: BTreeMap<u16, Stream>, pub crc_error: u64, pub ts_sync_loss: u64, pub sync_byte_error: u64, pub pat_error: u64, pub continuity_count_error: u64, pub pmt_error: u64, pub transport_error: u64, pub pcr_repetition_error: u64, pub pcr_discontinuity_indicator_error: u64, pub pts_error: u64, }
Expand description

What each demuxed elementary stream delivered, and the audio frame sync it lost or could not verify, keyed by elementary stream PID; the PSI sections the stream as a whole lost to corruption; and its TR 101 290 errors.

Take one with Import::stats. Every count is cumulative for the life of the importer, so what an operator alarms on is the rate: a feed that resyncs once an hour is healthy, one that resyncs every second is losing audio, and one whose access units stop advancing while the mux keeps flowing has lost that stream.

The fields named for ETSI TR 101 290 (V1.4.1) checks count them at that standard’s fixed limits. They grade the stream as the importer received it, not the wire a receiver sees downstream. TR 101 290’s PID_error is covered, more strictly, by each row’s units and quiet: a dead video path behind a live mux still sends PCR-only packets on its PID, which a packet count reads as live. PCR_accuracy_error is not measured.

Export carries the same rows for the streams an exporter writes, so one schema reads both edges.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§streams: BTreeMap<u16, Stream>

One row per PID, ordered by PID: each elementary stream the PMT lists, carried or refused, and each PID no table claims that the importer dropped packets on. A dropped PID’s row names no track, is Class::Data, and counts its packets in Stream::refused. A PID keeps one row for its life: a PMT that claims it, releases it, or claims it again moves the row with its counters, and while dropped it names no track. Packets before every listed PMT has arrived are acquisition and not counted; so are null packets. An import of one program from a multiplex that lists others counts no PID no table claims, since another program’s PMT may. An SI PID has a .si row only once it counts Stream::unplaced sections.

§crc_error: u64

PAT and PMT sections dropped because their CRC-32 did not match. Each one left the table already in force standing, or, before any, delayed the program’s start to the next good repetition. Counted for the stream rather than per elementary stream, since the PSI PIDs have no row of their own. TR 101 290 2.2 CRC_error, on the PAT and PMT only: the reduced-SI set of its table 5.1b. Captured SI is not CRC-checked.

§ts_sync_loss: u64

1.1 TS_sync_loss: sync lost after two consecutive corrupt sync bytes on the packet grid, and acquired again after five correct ones (ISO/IEC 13818-1 G.1).

§sync_byte_error: u64

1.2 Sync_byte_error: a byte other than 0x47 where the grid expects a sync byte, while in sync.

§pat_error: u64

1.3 PAT_error_2: each 0.5 s of health clock without a PAT section on PID 0, and each packet on PID 0 that is scrambled or starts a section other than a PAT.

§continuity_count_error: u64

1.4 Continuity_count_error, on every PID but the null PID: a counter gap, or a third copy of a packet. A gap declared by discontinuity_indicator, the one duplicate ISO/IEC 13818-1 2.4.3.3 permits, and a payload-less packet repeating its counter are not errors. A loss of exactly 16 packets leaves the counter in step, and only a byte comparison tells a loss of 15 from a duplicate, so the count is a floor.

§pmt_error: u64

1.5 PMT_error_2: each 0.5 s of health clock without a PMT section on a PMT PID the PAT names for the imported program, and each scrambled packet on one.

§transport_error: u64

2.1 Transport_error: packets with transport_error_indicator set, on any PID. Such a packet counts nothing else.

§pcr_repetition_error: u64

2.3a PCR_repetition_error: consecutive PCR values more than 100 ms apart, or no advancing PCR for over 100 ms of health clock, counted once until the PCR advances. The health clock follows the PCR and, across a stall, the packets the multiplex carries at the constant rate the PCR measured, so it grades the encoder’s insertion however the input is batched. Without a measured rate it falls back to arrival, read once per input chunk, which includes upstream delays. A PCR-bearing signalled discontinuity resets the outage, and its PCR value difference is not graded.

§pcr_discontinuity_indicator_error: u64

2.3b PCR_discontinuity_indicator_error: consecutive PCR values outside 0 to 100 ms apart, backwards included, without discontinuity_indicator. On values a run of missing PCRs and an unsignalled jump are the same difference, so a forward step over 100 ms counts here and as a repetition error both.

§pts_error: u64

2.5 PTS_error: each 700 ms of health clock without a PTS on an elementary stream that has carried one. Verbatim streams are not graded: SCTE-35 and subtitles have no cadence to hold.

Implementations§

Source§

impl Snapshot

Source

pub fn is_empty(&self) -> bool

Whether no elementary stream has been registered yet and nothing has been lost.

Trait Implementations§

Source§

impl Clone for Snapshot

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 Snapshot

Source§

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

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

impl Default for Snapshot

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Snapshot

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for Snapshot

Source§

impl From<Export> for Snapshot

An export’s rows with every stream-wide counter zero, so one Log reads either edge.

Source§

fn from(export: Export) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Snapshot

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 Serialize for Snapshot

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Snapshot

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
§

impl<T> CatalogExt for T
where T: Serialize + DeserializeOwned + Default + Clone + Send + Unpin + 'static,

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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, 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