diff --git a/crates/call/src/room.rs b/crates/call/src/room.rs index f19389c1ca..f6722dd13d 100644 --- a/crates/call/src/room.rs +++ b/crates/call/src/room.rs @@ -7,7 +7,7 @@ use client::{proto, Client, PeerId, TypedEnvelope, User, UserStore}; use collections::{BTreeMap, HashSet}; use futures::StreamExt; use gpui::{AsyncAppContext, Entity, ModelContext, ModelHandle, MutableAppContext, Task}; -use live_kit_client::{LocalTrackPublication, LocalVideoTrack, RemoteVideoTrackUpdate, Sid}; +use live_kit_client::{LocalTrackPublication, LocalVideoTrack, RemoteVideoTrackUpdate}; use postage::stream::Stream; use project::Project; use std::{mem, os::unix::prelude::OsStrExt, sync::Arc}; @@ -18,13 +18,8 @@ pub enum Event { ParticipantLocationChanged { participant_id: PeerId, }, - RemoteVideoTrackShared { + RemoteVideoTracksChanged { participant_id: PeerId, - track_id: Sid, - }, - RemoteVideoTrackUnshared { - peer_id: PeerId, - track_id: Sid, }, RemoteProjectShared { owner: Arc, @@ -448,9 +443,8 @@ impl Room { live_kit_track: track, }), ); - cx.emit(Event::RemoteVideoTrackShared { + cx.emit(Event::RemoteVideoTracksChanged { participant_id: peer_id, - track_id, }); } RemoteVideoTrackUpdate::Unsubscribed { @@ -463,7 +457,9 @@ impl Room { .get_mut(&peer_id) .ok_or_else(|| anyhow!("unsubscribed from track by unknown participant"))?; participant.tracks.remove(&track_id); - cx.emit(Event::RemoteVideoTrackUnshared { peer_id, track_id }); + cx.emit(Event::RemoteVideoTracksChanged { + participant_id: peer_id, + }); } } diff --git a/crates/collab/src/integration_tests.rs b/crates/collab/src/integration_tests.rs index b414839110..961f057bc5 100644 --- a/crates/collab/src/integration_tests.rs +++ b/crates/collab/src/integration_tests.rs @@ -203,16 +203,15 @@ async fn test_basic_calls( assert_eq!(events_b.borrow().len(), 1); let event = events_b.borrow().first().unwrap().clone(); - if let call::room::Event::RemoteVideoTrackShared { - participant_id, - track_id, - } = event - { + if let call::room::Event::RemoteVideoTracksChanged { participant_id } = event { assert_eq!(participant_id, client_a.peer_id().unwrap()); room_b.read_with(cx_b, |room, _| { - assert!(room.remote_participants()[&client_a.peer_id().unwrap()] - .tracks - .contains_key(&track_id)); + assert_eq!( + room.remote_participants()[&client_a.peer_id().unwrap()] + .tracks + .len(), + 1 + ); }); } else { panic!("unexpected event") diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index a318852359..c3e54c525b 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -2621,15 +2621,9 @@ impl Workspace { cx: &mut ViewContext, ) { match event { - call::room::Event::ParticipantLocationChanged { - participant_id: peer_id, - } - | call::room::Event::RemoteVideoTrackShared { - participant_id: peer_id, - .. - } - | call::room::Event::RemoteVideoTrackUnshared { peer_id, .. } => { - self.leader_updated(*peer_id, cx); + call::room::Event::ParticipantLocationChanged { participant_id } + | call::room::Event::RemoteVideoTracksChanged { participant_id } => { + self.leader_updated(*participant_id, cx); } _ => {} }