pub(crate) struct DeliveryRing {
pub(crate) q: Mutex<Option<VecDeque<(Vec<u8>, u64)>>>,
pub(crate) cv: Condvar,
pub(crate) dropped: AtomicU64,
pub(crate) capacity: usize,
}Expand description
Bounded, drop-oldest hand-off from the capture thread to the Python delivery thread, so a slow or GIL-blocked callback can never stall the PulseAudio pump.
The capture thread pushes encoded (frame, pts) pairs; the delivery thread blocks in
pop. Stale audio is worthless, so overflow past capacity (a few frames of slack)
discards the OLDEST frame and bumps dropped. close empties the queue to None and
wakes the consumer so it exits.
Fields§
§q: Mutex<Option<VecDeque<(Vec<u8>, u64)>>>§cv: Condvar§dropped: AtomicU64§capacity: usizeImplementations§
Source§impl DeliveryRing
impl DeliveryRing
Sourcepub(crate) fn push(&self, data: Vec<u8>, pts: u64)
pub(crate) fn push(&self, data: Vec<u8>, pts: u64)
Enqueue one encoded frame, dropping the oldest (and bumping dropped) if the
ring is at capacity, then wake the consumer. A no-op once closed.
Auto Trait Implementations§
impl !Freeze for DeliveryRing
impl RefUnwindSafe for DeliveryRing
impl Send for DeliveryRing
impl Sync for DeliveryRing
impl Unpin for DeliveryRing
impl UnsafeUnpin for DeliveryRing
impl UnwindSafe for DeliveryRing
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
Mutably borrows from an owned value. Read more