This commit is contained in:
Nathan Sobo 2022-10-17 23:47:55 -06:00
parent c73e2c2d0f
commit 59fab0bb2d
3 changed files with 12 additions and 15 deletions

View file

@ -334,7 +334,7 @@ impl Room {
let tracks = room.remote_video_tracks(&peer_id.0.to_string()); let tracks = room.remote_video_tracks(&peer_id.0.to_string());
dbg!(tracks.len()); dbg!(tracks.len());
for track in tracks { for track in tracks {
dbg!(track.id(), track.publisher_id()); dbg!(track.sid(), track.publisher_id());
this.remote_video_track_updated( this.remote_video_track_updated(
RemoteVideoTrackUpdate::Subscribed(track), RemoteVideoTrackUpdate::Subscribed(track),
cx, cx,
@ -386,9 +386,9 @@ impl Room {
) -> Result<()> { ) -> Result<()> {
match change { match change {
RemoteVideoTrackUpdate::Subscribed(track) => { RemoteVideoTrackUpdate::Subscribed(track) => {
dbg!(track.publisher_id(), track.id()); dbg!(track.publisher_id(), track.sid());
let peer_id = PeerId(track.publisher_id().parse()?); let peer_id = PeerId(track.publisher_id().parse()?);
let track_id = track.id().to_string(); let track_id = track.sid().to_string();
let participant = self let participant = self
.remote_participants .remote_participants
.get_mut(&peer_id) .get_mut(&peer_id)
@ -600,10 +600,10 @@ impl Room {
}; };
cx.foreground().spawn(async move { cx.foreground().spawn(async move {
let display = live_kit_client::display_sources().await?; let displays = live_kit_client::display_sources().await?;
// let display = displays let display = displays
// .first() .first()
// .ok_or_else(|| anyhow!("no display found"))?; .ok_or_else(|| anyhow!("no display found"))?;
let track = LocalVideoTrack::screen_share_for_display(&display); let track = LocalVideoTrack::screen_share_for_display(&display);
room.publish_video_track(&track).await?; room.publish_video_track(&track).await?;
Ok(()) Ok(())

View file

@ -1,4 +1,3 @@
use core_foundation::base::CFRetain;
use futures::StreamExt; use futures::StreamExt;
use gpui::{ use gpui::{
actions, actions,

View file

@ -16,8 +16,6 @@ use std::{
}; };
pub type Sid = String; pub type Sid = String;
#[allow(non_camel_case_types)]
pub type sid = str;
extern "C" { extern "C" {
fn LKRelease(object: *const c_void); fn LKRelease(object: *const c_void);
@ -278,24 +276,24 @@ impl Drop for LocalVideoTrack {
#[derive(Debug)] #[derive(Debug)]
pub struct RemoteVideoTrack { pub struct RemoteVideoTrack {
native_track: *const c_void, native_track: *const c_void,
id: Sid, sid: Sid,
publisher_id: String, publisher_id: String,
} }
impl RemoteVideoTrack { impl RemoteVideoTrack {
pub fn new(native_track: *const c_void, id: Sid, publisher_id: String) -> Self { fn new(native_track: *const c_void, sid: Sid, publisher_id: String) -> Self {
unsafe { unsafe {
CFRetain(native_track); CFRetain(native_track);
} }
Self { Self {
native_track, native_track,
id, sid,
publisher_id, publisher_id,
} }
} }
pub fn id(&self) -> &str { pub fn sid(&self) -> &str {
&self.id &self.sid
} }
pub fn publisher_id(&self) -> &str { pub fn publisher_id(&self) -> &str {