pub struct ScreencastPump { /* private fields */ }Expand description
A CDP screencast attached to one page, fanned out to any number of consumers.
Attaching pins the viewport but does not start capture — capture begins
on the first Self::subscribe and ends only when Self::stop is
called, which stops delivery to every consumer at once. There is
deliberately no per-consumer unsubscribe: consumers are meant to be
centrally gated (a future privacy blackout stops the whole pump, not
each consumer individually).
Implementations§
Source§impl ScreencastPump
impl ScreencastPump
Sourcepub async fn attach(
page: &Page,
quality: i64,
every_nth_frame: i64,
max_width: u32,
max_height: u32,
) -> Result<Self, BrowserError>
pub async fn attach( page: &Page, quality: i64, every_nth_frame: i64, max_width: u32, max_height: u32, ) -> Result<Self, BrowserError>
Attach to page and pin its viewport. Does not start capturing —
call Self::subscribe to begin.
every_nth_frame throttles Chrome’s emission at the source —
cheaper than capturing everything and dropping frames later.
Sourcepub async fn subscribe(&self) -> Result<(FrameReceiver, Instant), BrowserError>
pub async fn subscribe(&self) -> Result<(FrameReceiver, Instant), BrowserError>
Register a consumer. The first subscription starts CDP capture; a pump already capturing just gains another fan-out target — the running capture is untouched. Returns the receiver plus the instant capture started, so a consumer can compute frame durations on the same clock the frames themselves are timestamped against.
Trait Implementations§
Source§impl Drop for ScreencastPump
impl Drop for ScreencastPump
Source§fn drop(&mut self)
fn drop(&mut self)
Dropping a pump must end its capture, not orphan it.
Dropping a tokio JoinHandle detaches its task rather than
aborting it, so without this the pump loop survived its own pump:
it kept acking and fanning out frames, kept its consumers’
senders alive (so “zero consumers” never tripped anywhere above),
and Page.stopScreencast was never sent — leaving Chrome
capturing for the life of the process. Two live paths reach this:
a RecordingHandle dropped without stop(), and
FrameFanout::set_quality, which abort()s the supervisor task
that owns the pump as a task local.
Auto Trait Implementations§
impl !Freeze for ScreencastPump
impl !RefUnwindSafe for ScreencastPump
impl !UnwindSafe for ScreencastPump
impl Send for ScreencastPump
impl Sync for ScreencastPump
impl Unpin for ScreencastPump
impl UnsafeUnpin for ScreencastPump
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more