This message was deleted.
# sdk-rust
s
This message was deleted.
b
You can disable it using RoomOptions (used by Room::connect)
e
ah cool! I was using an older version
how can I do to manually subscribe to tracks when I join a room?
I'm currently trying this:
Copy code
for (_participant_sid, participant) in room.participants() {
                debug!("participant: {:?}", participant);
                for (track_sid, publication) in participant.tracks() {
                    debug!("\ttrack_publication: {} = {:?}", track_sid, publication);
                    if let Some(remote_publication) = participant.get_track_publication(&track_sid) {
                        debug!("\tremote_publication: {:?}", remote_publication);
                        remote_publication.set_subscribed(true).await;
                    }
                }
            }
b
set_subscribed(true) should work
Isn’t it the case?
e
it's getting stuck in the
await
it calls the first time for the first track, and gets stuck there
👍 1
b
ok this is an issue, I’ll take a look
e
I'll debug a bit more - I'm not using the vanilla client-sdk-rust so it may very well be my fault
👌 1
but thank you for the quick response!
🙏 1
yep apparently it's a bug - on
livekit/src/room/publication/remote.rs::set_subscribed
when holding the
info
variable declared on
let mut info = <http://self.remote.info|self.remote.info>.write();
it locks a
RwLock
that then will block when trying to do the
self.emit_subscription_update(old_subscription_state);
below
emit_permission_update
will try to read the
self.permission_status()
, which will try to read the
self.is_allowed()
, which will attempt to access
<http://self.remote.info|self.remote.info>
which will block
one workaround I'm doing now is to put the
info
block from
set_subscribed
as a scoped variable
Copy code
pub async fn set_subscribed(&self, subscribed: bool) {
        let old_subscription_state = self.subscription_status();
        let old_permission_state = self.permission_status();
       
        {
            let mut info = self.remote.info.write();
            info.subscribed = subscribed;

            if subscribed {
                info.allowed = true;
            }
        }
        ...
so the lock is released and things move on
but still - I'm not getting any
RoomEvent
after that - so I guess it's blocking somewhere else
am I supposed to receive a
RoomEvent::TrackSubscribed
if the manual subscription succeeds?
b
Yes, you’re right, I’m going to take a look
Manual subscription is now fixed with this PR
🙌 3
Thanks for the report 🙂
e
thank you for this awesome work!
1