-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Problem to solve
We want to provide a better indication of a media connection state.
Proposal
Expose PeerConnectionState a getter and on change callback.
This should probably go to ConnectionHandle, so it will be ConnectionHandle.get_state() and ConnectionHandle.on_state_change(). This is pretty straightforward for a P2P mode since RTCPeerConnection is 1-to-1 to the corresponding ConnectionHandle. But its a bit of a mess in SFU mode since there are 4 peers serving a connection between members: this member's rx and tx and that member's rx and tx peers. So the most correct way to implement this would probably be:
enum MemberConnectionState {
P2P(ConnectionState),
SFU {
local_tx: Option<ConnectionState>,
local_rx: Option<ConnectionState>,
remote_tx: Option<ConnectionState>,
remote_rx: Option<ConnectionState>,
}
}
And another thing is that the only way to get remote peers connection state is only if we get notified by server. So this should probably be split in 2 tasks: for P2P and for SFU.