webrtcsink: wait for Sessions to end
State::finalize_session()
asynchronously sets the Session pipeline to Null.
In some cases, sessions webrtcbin
could terminate their transition to Null
after webrtcsink
had reached Null.
This commit adds a set of finalizing_sessions
. When the finalization process
starts, the session is added to the set. After webrtcbin
has reached the Null
state, the session is removed from the set and a condvar is notified.
In unprepare
, webrtcsink
loops until the finalizing_sessions
set is
empty, awaiting for the condvar to be notified when it's not.