No SDP offer from Janus when participant leaves

I use the videoroom plugin. I recently updated to Janus Gateway v1.2.0. When a participant leaves a room (sending “leave” on both the publisher and the subscriber handle) the remaining participants that subscribed on the leaving participant do not get a new SDP offer from Janus. In my previous version (1+ year old) the remaining participants always get an “attached” message with a new SDP offer.

My current implementation assumes that this new offer will be sent out when someone leaves. Is it an intentional change that I should adapt to or is it a mistake?

1 Like

Check autoupdate in the documentation, it should be on by default (it does work like that in the mvideoroom demo, for instance).

1 Like

Thank you for the quick response. I investigated further, and it turns out that sometimes I actually get the offer when someone leaves.

It looks like there is a race condition in my application. When I get a “leaving” event, I unsubscribe from the leaving publisher’s stream. But I also detach the publisher and subscriber handles for the leaving participant. Sometimes Janus receives the Detatch request before the Unsubscribe request, causing the latter to fail (“Publisher not found, not unsubscribing…”).

Do I need to manually detach the publisher and subscriber handles for leaving participants, or is that cleaned up automatically later, such as when destroying the room?

Manually detaching leaving participants is the proper thing to do.