Skip to main content

FakeFrameInjector

Struct FakeFrameInjector 

Source
pub struct FakeFrameInjector { /* private fields */ }
Expand description

Test-only handle for simulating a live Frame::Video arrival in unit tests. See StreamSource::start_inert_for_test_with_gap_and_injector.

pub (not pub(crate)) so tests/fixture_replay.rs can drive production’s gap-detection ticker from an integration test. The #[cfg(any(test, feature = "test-util"))] gate on the struct + impl keeps this out of release builds; the test-util feature is only pulled in by bairelay’s own [dev-dependencies] self-reference.

Implementations§

Source§

impl FakeFrameInjector

Source

pub fn inject_fake_video_frame(&self)

Mark the source as having just received a real live video frame. Mirrors a SUBSET of the state updates that reader_task performs after a successful BcMedia::Iframe / Pframe translation.

Of production’s four live-frame state mutations, this helper replicates two and skips two:

Replicated:

  • last_live_frame_at — bumped to Instant::now() so the gap ticker sees a fresh live frame.
  • gap_state — forced back to GapState::Live.

Skipped:

  • last_emitted_pts_90khz — real reader advances this from the decoded frame’s PTS so replay can synthesize continuous timestamps; tests that assert PTS continuity must set it manually.
  • last_emit_wallclock_at — real reader stamps wall-clock per emit so the Bridging ticker knows when to fire; tests that depend on ticker phase must set it manually.

Does NOT broadcast — use Self::broadcast_live_video_frame when a downstream subscriber needs to actually see the frame.

Source

pub fn broadcast_live_video_frame(&self, frame: Frame)

Near-reader-task-equivalent “live video frame arrived” event: broadcast frame on the source’s tx channel AND update the gap-detection markers so the ticker stays in Live state. Used by the Task 11 integration test in tests/fixture_replay.rs to drive a real StreamSource through Live → Bridging → Live transitions with frames that actually reach attached RTSP subscribers.

NOT a full production mock. Delegates to Self::inject_fake_video_frame for state updates, which only touches last_live_frame_at + gap_state. Production’s last_emitted_pts_90khz and last_emit_wallclock_at are NOT advanced here — a future test author who needs PTS-continuity or ticker-phase accuracy must write those directly.

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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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