pub struct Call { /* private fields */ }Expand description
One live call.
Implementations§
Source§impl Call
impl Call
Sourcepub fn events(&self) -> Receiver<CallEvent>
pub fn events(&self) -> Receiver<CallEvent>
The call’s events (state, participants, speaking, errors).
Sourcepub fn snapshot(&self) -> CallSnapshot
pub fn snapshot(&self) -> CallSnapshot
The current state and participants.
Sourcepub fn stats(&self) -> CallStatsReport
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).
Sourcepub fn set_playout_stats(&self, source: Arc<dyn PlayoutStats>)
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.
Sourcepub fn noise_removal(&self) -> Option<NoiseRemovalState>
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.
Sourcepub async fn mute(
&self,
muted: Option<bool>,
deafened: Option<bool>,
) -> Result<(), CallError>
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.
Sourcepub fn recording(&self) -> Option<CallRecording>
pub fn recording(&self) -> Option<CallRecording>
The call’s active recording as Sew says it (or the notice of a held join), if any.
Sourcepub fn recording_controls(&self) -> Option<ServerControls>
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.
Sourcepub fn server_controls(&self) -> bool
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.
Sourcepub async fn consent(
&self,
granted: bool,
notice_version: u32,
) -> Result<(), CallError>
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).
Sourcepub async fn withdraw_consent(&self) -> Result<(), CallError>
pub async fn withdraw_consent(&self) -> Result<(), CallError>
“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.
Sourcepub async fn start_recording(&self) -> Result<(), CallError>
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.
Sourcepub async fn stop_recording(&self) -> Result<(), CallError>
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.
Sourcepub fn network_changed(&self)
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).
Sourcepub async fn leave(self) -> Result<(), CallError>
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.
Sourcepub fn leaver(&self) -> CallLeaver
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).
Sourcepub fn local_id(&self) -> u64
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).
Sourcepub fn push_opus(&self, f: OpusFrame)
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.
Sourcepub fn frame_sender(&self) -> FrameSender
pub fn frame_sender(&self) -> FrameSender
A cloneable handle to the send queue (for an audio thread or task).
Sourcepub fn frames(&self) -> Option<FrameStream>
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.
Sourcepub fn video_frames(&self) -> Option<VideoFrameStream>
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.
Sourcepub fn video_codecs(&self) -> Vec<VideoCodec>
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.
Sourcepub fn video_codec_preference(&self) -> VideoCodecPreference
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.
Sourcepub fn video_sink(&self, track_sid: &str, spec: VideoSinkSpec) -> VideoSink
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.
Sourcepub fn media_policy(&self) -> Option<MediaPolicy>
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.
Sourcepub fn video_stats(&self) -> VideoSendStats
pub fn video_stats(&self) -> VideoSendStats
The send-side video counters.
Sourcepub async fn set_video_lease(
&self,
source: VideoSource,
on: bool,
) -> Result<(), VideoError>
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).
Sourcepub async fn publish_video(
&self,
req: VideoPublish,
) -> Result<VideoPublication, VideoError>
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.
Sourcepub async fn unpublish_video(
&self,
source: VideoSource,
release_lease: bool,
) -> Result<(), VideoError>
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.
Sourcepub async fn unpublish_video_because(
&self,
source: VideoSource,
release_lease: bool,
reason: &str,
) -> Result<(), VideoError>
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, …).
Sourcepub fn set_video_muted(&self, source: VideoSource, muted: bool)
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.
Sourcepub fn set_video_caps(&self, caps: VideoCaps)
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§
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> 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> CryptoSafe for T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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