pub struct Conference { /* private fields */ }Expand description
Several calls mixed together.
Participants join and leave while it runs. Neither disturbs the others: the mixing clock does not stop, and a participant who leaves simply stops contributing and stops being sent to.
Implementations§
Source§impl Conference
impl Conference
Sourcepub fn new(
samples_per_frame: usize,
interval: Duration,
) -> Result<Self, ConferenceError>
pub fn new( samples_per_frame: usize, interval: Duration, ) -> Result<Self, ConferenceError>
Start an empty conference, mixing at this frame size and interval.
The interval must match what the participants’ sessions send at, or the conference produces frames faster or slower than they can be played and the queues drift. It must also be at least one millisecond.
§Errors
Returns ConferenceError::IntervalTooShort before spawning the mixer when interval
is shorter than one millisecond.
Sourcepub fn narrowband() -> Result<Self, ConferenceError>
pub fn narrowband() -> Result<Self, ConferenceError>
A conference at the usual telephony rate: 20 ms frames of 8 kHz audio.
§Errors
The fixed interval currently satisfies ConferenceError’s minimum. The fallible return
keeps this convenience constructor on the same explicit startup contract as Self::new.
Sourcepub async fn join(&self, session: Arc<MediaSession>) -> u64
pub async fn join(&self, session: Arc<MediaSession>) -> u64
Add a participant, and return the handle used to remove them.
Sourcepub async fn leave(&self, id: u64)
pub async fn leave(&self, id: u64)
Remove a participant.
The others carry on. Their mixes simply stop containing this one, which is what leaving a conversation sounds like.
Sourcepub fn samples_per_frame(&self) -> usize
pub fn samples_per_frame(&self) -> usize
The frame size being mixed at.
Trait Implementations§
Source§impl Debug for Conference
impl Debug for Conference
Source§impl Drop for Conference
impl Drop for Conference
Auto Trait Implementations§
impl !Freeze for Conference
impl !RefUnwindSafe for Conference
impl Send for Conference
impl Sync for Conference
impl Unpin for Conference
impl UnsafeUnpin for Conference
impl !UnwindSafe for Conference
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