This commit is contained in:
Mikayla Maki 2023-06-27 19:25:46 -07:00
parent 5d02b49058
commit 749f60ba81
No known key found for this signature in database
4 changed files with 17 additions and 11 deletions

View file

@ -88,8 +88,9 @@ impl View for CollabTitlebarItem {
right_container.add_child(self.render_leave_call(&theme, cx));
let muted = room.read(cx).is_muted();
let speaking = room.read(cx).is_speaking();
left_container
.add_child(self.render_current_user(&workspace, &theme, &user, peer_id, muted, speaking, cx));
left_container.add_child(
self.render_current_user(&workspace, &theme, &user, peer_id, muted, speaking, cx),
);
left_container.add_children(self.render_collaborators(&workspace, &theme, &room, cx));
right_container.add_child(self.render_toggle_mute(&theme, &room, cx));
right_container.add_child(self.render_toggle_deafen(&theme, &room, cx));

View file

@ -110,10 +110,7 @@ fn main() {
// Clear out any active speakers changed messages
let mut next = audio_track_updates.next().await.unwrap();
while let RemoteAudioTrackUpdate::ActiveSpeakersChanged {
speakers
} = next
{
while let RemoteAudioTrackUpdate::ActiveSpeakersChanged { speakers } = next {
println!("Speakers changed: {:?}", speakers);
next = audio_track_updates.next().await.unwrap();
}

View file

@ -402,10 +402,14 @@ impl Room {
// A vec of publisher IDs
fn active_speakers_changed(&self, speakers: Vec<String>) {
self.remote_audio_track_subscribers.lock().retain(move |tx| {
tx.unbounded_send(RemoteAudioTrackUpdate::ActiveSpeakersChanged { speakers: speakers.clone() })
self.remote_audio_track_subscribers
.lock()
.retain(move |tx| {
tx.unbounded_send(RemoteAudioTrackUpdate::ActiveSpeakersChanged {
speakers: speakers.clone(),
})
.is_ok()
});
});
}
fn did_subscribe_to_remote_video_track(&self, track: RemoteVideoTrack) {
@ -544,7 +548,11 @@ impl RoomDelegate {
let speakers = unsafe {
CFArray::wrap_under_get_rule(participants)
.into_iter()
.map(|speaker: core_foundation::base::ItemRef<'_, *const c_void>| CFString::wrap_under_get_rule(*speaker as CFStringRef).to_string())
.map(
|speaker: core_foundation::base::ItemRef<'_, *const c_void>| {
CFString::wrap_under_get_rule(*speaker as CFStringRef).to_string()
},
)
.collect()
};

View file

@ -581,7 +581,7 @@ pub enum RemoteVideoTrackUpdate {
#[derive(Clone)]
pub enum RemoteAudioTrackUpdate {
ActiveSpeakersChanged { speakers: Vec<Sid> },
MuteChanged { track_id: Sid, muted: bool},
MuteChanged { track_id: Sid, muted: bool },
Subscribed(Arc<RemoteAudioTrack>),
Unsubscribed { publisher_id: Sid, track_id: Sid },
}