Use livekit's Rust SDK instead of their swift SDK (#13343)
See https://github.com/livekit/rust-sdks/pull/355 Todo: * [x] make `call` / `live_kit_client` crates use the livekit rust sdk * [x] create a fake version of livekit rust API for integration tests * [x] capture local audio * [x] play remote audio * [x] capture local video tracks * [x] play remote video tracks * [x] tests passing * bugs * [x] deafening does not work (https://github.com/livekit/rust-sdks/issues/359) * [x] mute and speaking status are not replicated properly: (https://github.com/livekit/rust-sdks/issues/358) * [x] **linux** - crash due to symbol conflict between WebRTC's BoringSSL and libcurl's openssl (https://github.com/livekit/rust-sdks/issues/89) * [x] **linux** - libwebrtc-sys adds undesired dependencies on `libGL` and `libXext` * [x] **windows** - linker error, maybe related to the C++ stdlib (https://github.com/livekit/rust-sdks/issues/364) ``` libwebrtc_sys-54978c6ad5066a35.rlib(video_frame.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in libtree_sitter_yaml-df6b0adf8f009e8f.rlib(2e40c9e35e9506f4-scanner.o) ``` * [x] audio problems Release Notes: - Switch from Swift to Rust LiveKit SDK 🦀 --------- Co-authored-by: Mikayla Maki <mikayla@zed.dev> Co-authored-by: Conrad Irwin <conrad@zed.dev> Co-authored-by: Kirill Bulatov <kirill@zed.dev> Co-authored-by: Michael Sloan <michael@zed.dev>
This commit is contained in:
parent
6ff69faf37
commit
1235d0808e
48 changed files with 3212 additions and 2805 deletions
|
@ -2,16 +2,13 @@ use crate::{
|
|||
item::{Item, ItemEvent},
|
||||
ItemNavHistory, WorkspaceId,
|
||||
};
|
||||
use anyhow::Result;
|
||||
use call::participant::{Frame, RemoteVideoTrack};
|
||||
use call::{RemoteVideoTrack, RemoteVideoTrackView};
|
||||
use client::{proto::PeerId, User};
|
||||
use futures::StreamExt;
|
||||
use gpui::{
|
||||
div, surface, AppContext, EventEmitter, FocusHandle, FocusableView, InteractiveElement,
|
||||
ParentElement, Render, SharedString, Styled, Task, View, ViewContext, VisualContext,
|
||||
WindowContext,
|
||||
div, AppContext, EventEmitter, FocusHandle, FocusableView, InteractiveElement, ParentElement,
|
||||
Render, SharedString, Styled, View, ViewContext, VisualContext, WindowContext,
|
||||
};
|
||||
use std::sync::{Arc, Weak};
|
||||
use std::sync::Arc;
|
||||
use ui::{prelude::*, Icon, IconName};
|
||||
|
||||
pub enum Event {
|
||||
|
@ -19,40 +16,30 @@ pub enum Event {
|
|||
}
|
||||
|
||||
pub struct SharedScreen {
|
||||
track: Weak<RemoteVideoTrack>,
|
||||
frame: Option<Frame>,
|
||||
pub peer_id: PeerId,
|
||||
user: Arc<User>,
|
||||
nav_history: Option<ItemNavHistory>,
|
||||
_maintain_frame: Task<Result<()>>,
|
||||
view: View<RemoteVideoTrackView>,
|
||||
focus: FocusHandle,
|
||||
}
|
||||
|
||||
impl SharedScreen {
|
||||
pub fn new(
|
||||
track: &Arc<RemoteVideoTrack>,
|
||||
track: RemoteVideoTrack,
|
||||
peer_id: PeerId,
|
||||
user: Arc<User>,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) -> Self {
|
||||
cx.focus_handle();
|
||||
let mut frames = track.frames();
|
||||
let view = cx.new_view(|cx| RemoteVideoTrackView::new(track.clone(), cx));
|
||||
cx.subscribe(&view, |_, _, ev, cx| match ev {
|
||||
call::RemoteVideoTrackViewEvent::Close => cx.emit(Event::Close),
|
||||
})
|
||||
.detach();
|
||||
Self {
|
||||
track: Arc::downgrade(track),
|
||||
frame: None,
|
||||
view,
|
||||
peer_id,
|
||||
user,
|
||||
nav_history: Default::default(),
|
||||
_maintain_frame: cx.spawn(|this, mut cx| async move {
|
||||
while let Some(frame) = frames.next().await {
|
||||
this.update(&mut cx, |this, cx| {
|
||||
this.frame = Some(frame);
|
||||
cx.notify();
|
||||
})?;
|
||||
}
|
||||
this.update(&mut cx, |_, cx| cx.emit(Event::Close))?;
|
||||
Ok(())
|
||||
}),
|
||||
focus: cx.focus_handle(),
|
||||
}
|
||||
}
|
||||
|
@ -72,11 +59,7 @@ impl Render for SharedScreen {
|
|||
.track_focus(&self.focus)
|
||||
.key_context("SharedScreen")
|
||||
.size_full()
|
||||
.children(
|
||||
self.frame
|
||||
.as_ref()
|
||||
.map(|frame| surface(frame.image()).size_full()),
|
||||
)
|
||||
.child(self.view.clone())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -114,8 +97,13 @@ impl Item for SharedScreen {
|
|||
_workspace_id: Option<WorkspaceId>,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) -> Option<View<Self>> {
|
||||
let track = self.track.upgrade()?;
|
||||
Some(cx.new_view(|cx| Self::new(&track, self.peer_id, self.user.clone(), cx)))
|
||||
Some(cx.new_view(|cx| Self {
|
||||
view: self.view.update(cx, |view, cx| view.clone(cx)),
|
||||
peer_id: self.peer_id,
|
||||
user: self.user.clone(),
|
||||
nav_history: Default::default(),
|
||||
focus: cx.focus_handle(),
|
||||
}))
|
||||
}
|
||||
|
||||
fn to_item_events(event: &Self::Event, mut f: impl FnMut(ItemEvent)) {
|
||||
|
|
|
@ -3939,6 +3939,17 @@ impl Workspace {
|
|||
None
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
fn shared_screen_for_peer(
|
||||
&self,
|
||||
_peer_id: PeerId,
|
||||
_pane: &View<Pane>,
|
||||
_cx: &mut WindowContext,
|
||||
) -> Option<View<SharedScreen>> {
|
||||
None
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
fn shared_screen_for_peer(
|
||||
&self,
|
||||
peer_id: PeerId,
|
||||
|
@ -3957,7 +3968,7 @@ impl Workspace {
|
|||
}
|
||||
}
|
||||
|
||||
Some(cx.new_view(|cx| SharedScreen::new(&track, peer_id, user.clone(), cx)))
|
||||
Some(cx.new_view(|cx| SharedScreen::new(track, peer_id, user.clone(), cx)))
|
||||
}
|
||||
|
||||
pub fn on_window_activation_changed(&mut self, cx: &mut ViewContext<Self>) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue