pub struct MixerInputSink { /* private fields */ }Expand description
One AudioMixer input, returned by MixerHandle::add_source.
Resamples every incoming frame to the mixer’s fixed output format and
appends it to this input’s own buffer — the actual summing happens
later, on AudioMixer::run’s own thread, not here. consume runs on
whatever thread is driving the upstream source this got linked to
(a different pipeline’s own thread, in the normal case), so every
access to the shared input map goes through MixerShared’s lock.
Trait Implementations§
Source§impl Element for MixerInputSink
impl Element for MixerInputSink
Source§fn name(&self) -> Arc<str> ⓘ
fn name(&self) -> Arc<str> ⓘ
crate::bus::BusEvent stores names as
Arc<str> for exactly this reason: a hot path like
crate::queue::Queue posting BusEvent::Dropped once per
overflowed buffer shouldn’t pay for a fresh heap allocation every
time it wants to report which element it is.Source§fn element_type(&self) -> ElementType
fn element_type(&self) -> ElementType
ElementType.Source§fn pp_log(&self) -> &PpLog
fn pp_log(&self) -> &PpLog
crate::bus::Bus::post — same
id/name as Element::name, just already wrapped as the
crate::pp_log::PpLog its pp_info!/pp_warn!/pp_error! macros need. A
stored private field, not built fresh per call, for the same reason
name() returns a cheap Arc<str> clone instead of a fresh String
— see its own docs.Source§fn pp_log_mut(&mut self) -> &mut PpLog
fn pp_log_mut(&mut self) -> &mut PpLog
Element::pp_log reads — used by
crate::pipeline::ChainBuilder to stamp the owning
crate::pipeline::Pipeline’s id onto every element that
passes through it, via element_pp_log. Not meant to be called
from anywhere else.impl Send for MixerInputSink
Source§impl Sink for MixerInputSink
impl Sink for MixerInputSink
Source§fn control(&mut self, msg: ControlMsg) -> Result<()>
fn control(&mut self, msg: ControlMsg) -> Result<()>
No downstream of its own to cascade to — this is a leaf input slot,
not a passthrough. Stop removes this input immediately, same as
MixerHandle::remove_source: Stop means abandon now, not drain
to a natural Eos (see ControlMsg::Stop’s own docs), and for a
live capture source — WasapiCaptureSource
included — Stop is the only shutdown signal that ever arrives;
it never reaches Eos on its own. Relying on Eos alone to clean
up (as an earlier version of this did) left a stale entry in
shared.inputs forever whenever a caller stopped its capture
pipeline normally instead of remembering to call
MixerHandle::remove_source by hand. Pause/Resume/Seek need
no handling here — this input has no thread or queue of its own to
freeze/resume, and a live capture source doesn’t seek. Removal is
conditional on the registration ID: a late Stop from a replaced
sink must not remove the newer input using the same name.