pub(crate) struct CaptureManager {
active: HashMap<u16, StreamCapture>,
}Expand description
Manages multiple concurrent voice-stream captures.
A single Tier 3 connection can multiplex voice streams across modules
(e.g. a reflector with modules A, B, C each carrying an independent
transmission at the same time). The CaptureManager maps each wire
stream ID to its in-progress StreamCapture so that frames are
routed correctly.
§Lifecycle
Self::start— called onVoiceStart: registers a new capture keyed by the stream ID from the header.Self::push_frame— called onVoiceFrame: appends the frame to the matching capture (no-op if the stream ID is unknown, which can happen if we missed the header).Self::end— called onVoiceEnd: removes and returns the capture for finalization (MP3 encode + database insert).
Fields§
§active: HashMap<u16, StreamCapture>Active captures keyed by the wire stream ID.
Implementations§
Source§impl CaptureManager
impl CaptureManager
Sourcepub(crate) fn start(&mut self, capture: StreamCapture)
pub(crate) fn start(&mut self, capture: StreamCapture)
Registers a new capture. Replaces any existing entry for the same stream ID (a fresh header always supersedes any partial state).
Sourcepub(crate) fn push_frame(&mut self, stream_id: u16, frame: &VoiceFrame)
pub(crate) fn push_frame(&mut self, stream_id: u16, frame: &VoiceFrame)
Appends a voice frame to the capture matching stream_id.
No-op (logs a debug message) if no capture is registered for this
stream ID. This can happen if we joined the wire mid-stream and
missed the header, or if a stale frame arrives after we already
processed the VoiceEnd.
Sourcepub(crate) fn end(&mut self, stream_id: u16) -> Option<StreamCapture>
pub(crate) fn end(&mut self, stream_id: u16) -> Option<StreamCapture>
Finalizes and removes the capture matching stream_id.
Returns the captured state for downstream processing (MP3 encode,
database insert). Returns None if no capture was registered for
this stream ID.
Sourcepub(crate) fn active_count(&self) -> usize
pub(crate) fn active_count(&self) -> usize
Returns the number of captures currently in progress.
Used for observability (metrics exported on the HTTP API) and for backpressure decisions in the orchestrator.
Trait Implementations§
Source§impl Debug for CaptureManager
impl Debug for CaptureManager
Source§impl Default for CaptureManager
impl Default for CaptureManager
Source§fn default() -> CaptureManager
fn default() -> CaptureManager
Auto Trait Implementations§
impl Freeze for CaptureManager
impl RefUnwindSafe for CaptureManager
impl Send for CaptureManager
impl Sync for CaptureManager
impl Unpin for CaptureManager
impl UnwindSafe for CaptureManager
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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