webrtcsink: fix deadlock on error setting remote description

Avoids another attempt to lock the sesion mutex recursively.
Take a copy of the session id string to be passed to the signaller and
drop the session mutex after removal of session from the hashmap

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2331>
This commit is contained in:
Taruntej Kanakamalla 2025-07-01 13:33:59 +05:30
parent f835e075ea
commit fc0b433e29

View file

@ -3767,12 +3767,14 @@ impl BaseWebRTCSink {
if remove {
let _ = state.sessions.remove(&session.id);
let session_id = session.id.clone();
drop(session);
state.finalize_session(&self.obj(), Session(session_clone.clone()));
drop(state_guard);
let settings = self.settings.lock().unwrap();
let signaller = settings.signaller.clone();
drop(settings);
signaller.end_session(&session.id);
signaller.end_session(&session_id);
}
}