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

View file

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

View file

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