Skip to content

Commit

Permalink
fix: whipinto and whepfrom ice candidate
Browse files Browse the repository at this point in the history
  • Loading branch information
a-wing committed Mar 5, 2024
1 parent 5b53180 commit 48348f7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
16 changes: 13 additions & 3 deletions tools/whepfrom/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,19 @@ async fn webrtc_start(
)
.await?;
let offer = peer.create_offer(None).await?;
let (answer, _ice_servers) = client.wish(offer.sdp.clone()).await?;
peer.set_local_description(offer.clone()).await?;
peer.set_remote_description(answer).await?;

let mut gather_complete = peer.gathering_complete_promise().await;
peer.set_local_description(offer).await?;
let _ = gather_complete.recv().await;

let (answer, _ice_servers) = client
.wish(peer.local_description().await.unwrap().sdp.clone())
.await?;

peer.set_remote_description(answer)
.await
.map_err(|error| anyhow!(format!("{:?}: {}", error, error)))?;

Ok(peer)
}

Expand Down
16 changes: 13 additions & 3 deletions tools/whipinto/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,19 @@ async fn webrtc_start(
) -> Result<(Arc<RTCPeerConnection>, UnboundedSender<Vec<u8>>)> {
let (peer, sender) = new_peer(codec, complete_tx.clone()).await?;
let offer = peer.create_offer(None).await?;
let (answer, _ice_servers) = client.wish(offer.sdp.clone()).await?;
peer.set_local_description(offer.clone()).await?;
peer.set_remote_description(answer).await?;

let mut gather_complete = peer.gathering_complete_promise().await;
peer.set_local_description(offer).await?;
let _ = gather_complete.recv().await;

let (answer, _ice_servers) = client
.wish(peer.local_description().await.unwrap().sdp)
.await?;

peer.set_remote_description(answer)
.await
.map_err(|error| anyhow!(format!("{:?}: {}", error, error)))?;

Ok((peer, sender))
}

Expand Down

0 comments on commit 48348f7

Please sign in to comment.