Skip to main content

Call

Struct Call 

Source
pub struct Call { /* private fields */ }
Expand description

One live call.

Implementations§

Source§

impl Call

Source

pub fn events(&self) -> Receiver<CallEvent>

The call’s events (state, participants, speaking, errors).

Source

pub fn snapshot(&self) -> CallSnapshot

The current state and participants.

Source

pub fn stats(&self) -> CallStatsReport

The stats windows so far (the latest 256) and the beacon’s terms: the same numbers the beacon sends, measured whether or not it is on (see the stats module docs for how each is derived).

Source

pub fn set_playout_stats(&self, source: Arc<dyn PlayoutStats>)

Where the beacon’s played and concealed audio come from: the host’s own audio pipeline (one that does not use crate::AudioBridge, which reports kessel-audio’s). Without one, the engine reports what it handed the pipeline.

Source

pub fn noise_removal(&self) -> Option<NoiseRemovalState>

The noise removal of this call’s audio: {mode, active, reason} (crate::NoiseRemovalState), while audio started with crate::AudioBridge::start_with_noise runs; None otherwise.

Source

pub async fn mute( &self, muted: Option<bool>, deafened: Option<bool>, ) -> Result<(), CallError>

Mute and deafen (None leaves it). Deafened implies muted; un-deafening returns muted to its value before the deafen.

Source

pub fn recording(&self) -> Option<CallRecording>

The call’s active recording as Sew says it (or the notice of a held join), if any.

Source

pub fn recording_controls(&self) -> Option<ServerControls>

The person’s Record and Stop in the call’s room as Sew computed them last (the newest by rev of its recording_controls_updated, the call socket’s READY and the recording’s my_controls). None from an older server, before the server’s first value (Sew sends one once the call is connected), and after a move until the destination’s arrives.

Source

pub fn server_controls(&self) -> bool

This call’s server computes the person’s Record and Stop: its call socket’s READY carried recording_controls (even null), or a value arrived. false against an older server: the host works the buttons out itself.

Source

pub async fn consent( &self, granted: bool, notice_version: u32, ) -> Result<(), CallError>

The person’s answer to the recording’s notice (notice_version: the version they saw, CallState::ConsentRequired’s or the prompt’s). Held at consent_required, the engine re-joins with the answer (a decline joins unrecorded, or is refused when declining means not joining: the call ends). In a call, the host sends it (JoinProvider::consent). Either way this device’s key reaches the recorder only once Sew says granted. A notice that changed meanwhile answers Provider(ConsentRequired) with the current one (the call stays as it was).

“Stop recording me”: withdraws a granted consent through the host (Sew stops capturing this person at once and the keys rekey so the recorder gets no later key). Before an answer it is a decline.

Source

pub async fn start_recording(&self) -> Result<(), CallError>

Record (Sew 0.9.0): the person starts recording the call’s room through the host (JoinProvider::recording, with the person’s own session). Pressing Record is the person’s own consent, so show the notice as a confirmation first; everyone else stays unrecorded until they answer. Sew’s answer is the call’s recording at once (Call::recording, CallEvent::Recording). Refusals are Sew’s, as Provider(Refused { code, .. }) (recording_active, recording_disabled, cap_ceiling, …); while the join is held for a notice the person is not in the room yet, and it is refused not_in_voice without asking Sew.

Source

pub async fn stop_recording(&self) -> Result<(), CallError>

Stop (Sew 0.9.0): the person stops the room’s active recording through the host (JoinProvider::recording). CallError::NoRecording when none is active. Sew refuses recording_required while the room requires its recording and two or more people are in it (CallRecording::required); “Stop recording me” (Call::withdraw_consent) still works then.

Source

pub fn network_changed(&self)

The device’s network changed: the host calls this from its path monitor (iOS NWPathMonitor, Android ConnectivityManager.NetworkCallback) when the default route moves (Wi-Fi to cellular and back, a new Wi-Fi network, a VPN coming up). Never blocks; safe from any thread and to repeat.

In a call it runs the resume path now instead of waiting for the old connections to time out: the signalling WebSocket is replaced and the session resumes (JoinRequest.reconnect, the PC kept), a fresh transport is opened on the new network (a new TURN allocation over a new TURN-TLS / TCP / UDP socket and new host candidates) and swapped into the PC, then an ICE restart moves the media onto it; the call socket of the keys reconnects and resumes too. The state shows reconnecting until the resume is done. If the new transport can’t be opened, or the restart does not connect, the engine falls back to its full reconnect (and re-join) inside the usual window. Before the call is connected it retries the connect at once; while the join is held for a recording notice it does nothing (no connection is open).

Source

pub async fn leave(self) -> Result<(), CallError>

Leaves (Sew’s leave with the credential, then the engine’s). When it answers, the app’s call slot is free: a CallClient::join right after it is never CallError::AlreadyInCall. Dropping the Call without it leaves too.

Source

pub fn leaver(&self) -> CallLeaver

A handle that leaves this call from anywhere, without the Call itself: for a host that keeps the Call behind a lock that its camera or screen commands hold while they wait on a device, so a leave never waits for them (they get CallError::Ended or crate::VideoError::Ended once the call is over).

Source

pub fn local_id(&self) -> u64

A number this call alone has in the process (never reused), to tell its video pipelines from a later call’s (VideoBridge::close_call, with video-core).

Source

pub fn push_opus(&self, f: OpusFrame)

Queues one encoded frame to send. Never blocks: a full queue drops the frame (and counts it); the engine drops it too unless media is up and a send key is active.

Source

pub fn frame_sender(&self) -> FrameSender

A cloneable handle to the send queue (for an audio thread or task).

Source

pub fn frames(&self) -> Option<FrameStream>

The receive side (decrypted Opus per remote track, loss marks, mute and deafen), for the audio pipeline. The first call takes it; later calls get None.

Source

pub fn video_frames(&self) -> Option<VideoFrameStream>

The video receive side: decrypted, verified encoded frames of the remote camera and screen tracks that have an open sink (Call::video_sink), with each track’s Added, Removed, Broken and KeyframeNeeded. The first call takes it; later calls get None. Without video-core the engine negotiates no video and nothing arrives.

Source

pub fn video_codecs(&self) -> Vec<VideoCodec>

The video codecs this call’s media connection offers to receive (VP8 first; H.264 only when the join’s CallClient::set_video_decode and preference allowed it). Fixed at the join; the publish side can send only these too. Empty without video-core.

Source

pub fn video_codec_preference(&self) -> VideoCodecPreference

This device’s video codec preference now (CallClient::set_video_codec_preference), for the publish side when a camera or screen turns on.

Source

pub fn video_sink(&self, track_sid: &str, spec: VideoSinkSpec) -> VideoSink

Opens a sink for the remote video track track_sid (CallEvent::VideoAdded): while at least one of a track’s sinks is open and visible, the engine asks the media server for it (the largest visible sink’s size, 30 fps for a large tile, 15 for a grid tile) and its frames flow through Call::video_frames, starting at a keyframe. With none, the track is disabled at the server and nothing is forwarded. Dropping the sink closes it.

Source

pub fn media_policy(&self) -> Option<MediaPolicy>

The client media policy of the join (its camera_allowed and screen_allowed) with the latest layer hints (media_policy_updated, a move), if the join answer had one.

Source

pub fn video_stats(&self) -> VideoSendStats

The send-side video counters.

Source

pub async fn set_video_lease( &self, source: VideoSource, on: bool, ) -> Result<(), VideoError>

Takes (on) or releases a video lease: Sew’s self_video for the camera, self_stream for a screen share (POST /api/v1/me/voice/state with the call credential). Refused with video_not_allowed when the join’s policy has video off or this session may not hold it, and with Sew’s own refusals (video_slots_full, media_busy with its Retry-After, media_capacity, video_disabled). A publication needs the lease first; releasing it does not unpublish (Call::unpublish_video does both).

Source

pub async fn publish_video( &self, req: VideoPublish, ) -> Result<VideoPublication, VideoError>

Publishes a camera or screen share under its lease: the AddTrackRequest with the layers that opened and the codec, the SFU’s TrackPublished confirmed GCM by the keys, then the simulcast send section. The handle takes each layer’s encoded frames and says what the engine needs (crate::video::VideoControl: keyframes, which layers run at what rates, a republish, the end). Refused with no_lease without the lease, e2ee_downgraded when the SFU drops GCM, already_published for a second publication of the source.

Source

pub async fn unpublish_video( &self, source: VideoSource, release_lease: bool, ) -> Result<(), VideoError>

Unpublishes the source’s track (its send section goes inactive; the producer gets Ended { reason: "unpublished" }) and, with release_lease, releases its lease.

Source

pub async fn unpublish_video_because( &self, source: VideoSource, release_lease: bool, reason: &str, ) -> Result<(), VideoError>

Call::unpublish_video with reason as the producer’s Ended and local_video’s reason (who turned it off: camera_off, camera_switch, system_ui, …).

Source

pub fn set_video_muted(&self, source: VideoSource, muted: bool)

Mutes or unmutes the source’s published track at the SFU (MuteTrackRequest) while keeping the publication and its lease: subscribers see the track muted (a phone app in the background, whose producer stops sending frames). Sent again after a republish or a reconnect. Nothing happens without a publication of the source.

Source

pub fn set_video_caps(&self, caps: VideoCaps)

Caps on top of the policy (thermal pressure, low power): each layer’s bitrate, the number of layers and the frame rate, applied before the bandwidth split.

Trait Implementations§

Source§

impl Debug for Call

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for Call

Source§

fn drop(&mut self)

The handle is gone: the engine leaves now, even while a video sink, a camera pipeline or a CallLeaver still holds its command queue (after a leave, nothing happens).

Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl !Freeze for Call

§

impl !RefUnwindSafe for Call

§

impl !UnwindSafe for Call

§

impl Forget for Call

§

impl Move for Call

§

impl Send for Call

§

impl Sync for Call

§

impl Unpin for Call

§

impl UnsafeUnpin for Call

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CryptoSafe for T
where T: Send + Sync + Debug,

Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more