Switch fully to Rust Livekit (redux) (#27126)

Swift bindings BEGONE

Release Notes:

- Switched from using the Swift LiveKit bindings, to the Rust bindings,
fixing https://github.com/zed-industries/zed/issues/9396, a crash when
leaving a collaboration session, and making Zed easier to build.

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
Co-authored-by: Michael Sloan <michael@zed.dev>
This commit is contained in:
Mikayla Maki 2025-03-28 10:58:23 -07:00 committed by GitHub
parent c8fb95cd1b
commit 8a307e7b89
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
68 changed files with 2393 additions and 7579 deletions

View file

@ -1,5 +1,4 @@
use crate::track::RemoteVideoTrack;
use anyhow::Result;
use super::RemoteVideoTrack;
use futures::StreamExt as _;
use gpui::{
AppContext as _, Context, Empty, Entity, EventEmitter, IntoElement, Render, Task, Window,
@ -12,7 +11,7 @@ pub struct RemoteVideoTrackView {
current_rendered_frame: Option<crate::RemoteVideoFrame>,
#[cfg(not(target_os = "macos"))]
previous_rendered_frame: Option<crate::RemoteVideoFrame>,
_maintain_frame: Task<Result<()>>,
_maintain_frame: Task<()>,
}
#[derive(Debug)]
@ -23,8 +22,27 @@ pub enum RemoteVideoTrackViewEvent {
impl RemoteVideoTrackView {
pub fn new(track: RemoteVideoTrack, window: &mut Window, cx: &mut Context<Self>) -> Self {
cx.focus_handle();
let frames = super::play_remote_video_track(&track);
let _window_handle = window.window_handle();
let frames = crate::play_remote_video_track(&track);
#[cfg(not(target_os = "macos"))]
{
use util::ResultExt;
let window_handle = window.window_handle();
cx.on_release(move |this, cx| {
if let Some(frame) = this.previous_rendered_frame.take() {
window_handle
.update(cx, |_, window, _cx| window.drop_image(frame).log_err())
.ok();
}
if let Some(frame) = this.current_rendered_frame.take() {
window_handle
.update(cx, |_, window, _cx| window.drop_image(frame).log_err())
.ok();
}
})
.detach();
}
Self {
track,
@ -35,28 +53,11 @@ impl RemoteVideoTrackView {
this.update(cx, |this, cx| {
this.latest_frame = Some(frame);
cx.notify();
})?;
})
.ok();
}
this.update(cx, |_this, cx| {
#[cfg(not(target_os = "macos"))]
{
use util::ResultExt as _;
if let Some(frame) = _this.previous_rendered_frame.take() {
_window_handle
.update(cx, |_, window, _cx| window.drop_image(frame).log_err())
.ok();
}
// TODO(mgsloan): This might leak the last image of the screenshare if
// render is called after the screenshare ends.
if let Some(frame) = _this.current_rendered_frame.take() {
_window_handle
.update(cx, |_, window, _cx| window.drop_image(frame).log_err())
.ok();
}
}
cx.emit(RemoteVideoTrackViewEvent::Close)
})?;
Ok(())
this.update(cx, |_this, cx| cx.emit(RemoteVideoTrackViewEvent::Close))
.ok();
}),
#[cfg(not(target_os = "macos"))]
current_rendered_frame: None,