Skip to main content

VideoBridge

Struct VideoBridge 

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

The video bridge: a kessel-video backend’s cameras, screens and encoders into a call, with the in-call self-view. The video bridge: a kessel-video backend’s cameras, screens and encoders into a call, with the in-call self-view. The video bridge: a kessel-video backend’s cameras, screens and encoders into a call, with the in-call self-view. The video bridge of one app: a kessel-video backend into the current call.

Implementations§

Source§

impl VideoBridge

Source

pub fn new(backend: Arc<dyn VideoBackend>) -> VideoBridge

A bridge over backend (one per app).

Source

pub fn with_capture(capture: VideoCapture) -> VideoBridge

A bridge over the app’s capture (its clones share the camera with the bridge: a preview opened through one of them hands the camera over to the camera publish).

Source

pub fn capture(&self) -> &VideoCapture

The capture the bridge opens its cameras through.

Source

pub fn backend(&self) -> &Arc<dyn VideoBackend> ⓘ

The backend.

Source

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

The published sources’ events (pauses, resumes, ends), from now on.

Source

pub fn self_view(&self) -> SelfViewFrames

The self-view from now on: each publication’s self-view layer (see the module docs), until the receiver is dropped or a newer one is asked for. While one is open the source never pauses, even with no layer wanted by anyone.

Source

pub fn self_view_keyframe(&self, source: VideoSource)

The self-view of source needs a keyframe (a sink opened, became visible or failed). Never blocks.

Source

pub async fn camera_state(&self) -> CameraState

The camera now: CameraState::On while VideoBridge::set_camera publishes it.

Source

pub async fn camera_device(&self) -> Option<String>

The camera device VideoBridge::set_camera publishes (None: the default, or off).

Source

pub async fn publish_source( &self, call: &Call, kind: VideoSource, feed: SourceFeed, temporal_layers: Option<u8>, ) -> Result<CameraState, VideoError>

Publishes kind from a source the host opened (see SourceFeed): the policy (video on, the source allowed), the lease (self_video or self_stream), the codec and one encoder per layer of the policy’s hints for that source, the publication and the pipeline. The bridge owns the source from here; VideoBridge::stop_source ends it, and so does the source’s own end.

Source

pub async fn publish_capture( &self, call: &Call, kind: VideoSource, capture: Capture, temporal_layers: Option<u8>, ) -> Result<CameraState, VideoError>

Publishes kind from a camera or screen opened through VideoCapture (a crate::ScreenSource with crate::ScreenSource::into_capture): its size from its first Started (at most its constraints), then as VideoBridge::publish_source.

Source

pub async fn stop_source( &self, call: &Call, kind: VideoSource, ) -> Result<(), VideoError>

Ends a VideoBridge::publish_source or VideoBridge::publish_capture publication: the track unpublished, the source dropped (closed), the lease released.

Source

pub async fn set_camera( &self, call: &Call, req: CameraRequest, ) -> Result<CameraState, VideoError>

Turns the camera on (see the module docs), switches it to another device, or turns it off (the track unpublished, the camera closed, the lease released).

Source

pub async fn switch_camera( &self, call: &Call, device: Option<String>, ) -> Result<CameraState, VideoError>

Switches the published camera to device (None: the default) when the camera is on; CameraState::Off and nothing opened when it is off (a host’s camera choice between set_camera calls).

Source

pub async fn pause_camera(&self, paused: bool) -> bool

Pauses (true) or resumes the camera’s pipeline, keeping its publication and lease (a phone app in the background): no frame is captured (the source is paused) or encoded while paused, and on the return every encoder is asked for a keyframe before the first frame is encoded. crate::Call::set_video_muted tells subscribers. false: no camera runs.

Source

pub async fn reopen_held_camera(&self, call: &Call) -> bool

Opens the camera again (the same device; the publication and the lease kept, a keyframe first) when the app is in front yet the camera is still paused by a background pause that the OS never ended and no frame came since. false: nothing to do (no camera, not held), or it did not open again; then the camera stays paused as it was (published, the lease kept, no frames) and a later call may try again. It never turns the camera off.

Source

pub async fn close_call(&self, call: u64)

Stops the pipelines of one call (its Call::local_id) without touching the call (it ended): a later call’s keep running. Each stop waits a short while at most; a pipeline whose source closes slowly finishes on its own.

Source

pub async fn close(&self)

Stops every pipeline without touching the call (the call ended).

Trait Implementations§

Source§

impl Debug for VideoBridge

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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