Fix deafening new participants (#28330)

Release Notes:

- Fixed an issue where new participants were not muted when the room was
deafened
This commit is contained in:
Conrad Irwin 2025-04-08 10:01:27 -06:00 committed by GitHub
parent 14b43d573c
commit ee7b1ec7f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 2 additions and 47 deletions

View file

@ -944,8 +944,8 @@ impl Room {
) )
})?; })?;
if self.live_kit.as_ref().map_or(true, |kit| kit.deafened) { if self.live_kit.as_ref().map_or(true, |kit| kit.deafened) {
if matches!(track, livekit_client::RemoteTrack::Audio(_)) { if publication.is_audio() {
track.set_enabled(false, cx); publication.set_enabled(false, cx);
} }
} }
match track { match track {

View file

@ -255,23 +255,6 @@ impl RemoteTrackPublication {
} }
} }
impl RemoteTrack {
pub fn set_enabled(&self, enabled: bool, cx: &App) {
let this = self.clone();
Tokio::spawn(cx, async move {
match this {
RemoteTrack::Audio(remote_audio_track) => {
remote_audio_track.0.rtc_track().set_enabled(enabled)
}
RemoteTrack::Video(remote_video_track) => {
remote_video_track.0.rtc_track().set_enabled(enabled)
}
}
})
.detach();
}
}
impl Participant { impl Participant {
pub fn identity(&self) -> ParticipantIdentity { pub fn identity(&self) -> ParticipantIdentity {
match self { match self {

View file

@ -89,12 +89,3 @@ impl RemoteTrackPublication {
} }
} }
} }
impl RemoteTrack {
pub fn set_enabled(&self, enabled: bool, _cx: &App) {
match self {
RemoteTrack::Audio(remote_audio_track) => remote_audio_track.set_enabled(enabled),
RemoteTrack::Video(remote_video_track) => remote_video_track.set_enabled(enabled),
}
}
}

View file

@ -43,23 +43,6 @@ impl RemoteAudioTrack {
false false
} }
} }
pub fn set_enabled(&self, enabled: bool) {
let Some(room) = self.room.upgrade() else {
return;
};
if enabled {
room.0
.lock()
.paused_audio_tracks
.remove(&self.server_track.sid);
} else {
room.0
.lock()
.paused_audio_tracks
.insert(self.server_track.sid.clone());
}
}
} }
impl RemoteVideoTrack { impl RemoteVideoTrack {
@ -70,6 +53,4 @@ impl RemoteVideoTrack {
pub fn publisher_id(&self) -> ParticipantIdentity { pub fn publisher_id(&self) -> ParticipantIdentity {
self.server_track.publisher_id.clone() self.server_track.publisher_id.clone()
} }
pub(crate) fn set_enabled(&self, _enabled: bool) {}
} }