Skip to content

Commit

Permalink
Fix panic related to connection state handling (versatica#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpgneves authored Jun 10, 2021
1 parent bffd2d6 commit b8ceeb4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mediasoupclient/src/api/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,13 @@ impl From<ffi::transport::ConnectionState> for PeerConnectionState {
}

#[cfg(not(target_arch = "wasm32"))]
// In native, we need to look directly at the ICE connection state change it seems?
// Similar mapping to https://github.com/versatica/mediasoup-client/blob/a813c39bde5c9493436d2f6c7af7fa310a96decd/src/handlers/Firefox60.ts#L213
fn from(s: ffi::transport::ConnectionState) -> Self {
match s.0.as_str() {
"new" => PeerConnectionState::New,
"connecting" => PeerConnectionState::Connecting,
"connected" => PeerConnectionState::Connected,
"checking" => PeerConnectionState::Connecting,
"connected" | "completed" => PeerConnectionState::Connected,
"failed" => PeerConnectionState::Failed,
"disconnected" => PeerConnectionState::Disconnected,
"closed" => PeerConnectionState::Closed,
Expand Down

0 comments on commit b8ceeb4

Please sign in to comment.