4
votes

I'm doing an iOS native WebRTC implementation and I'm trying to peer connect with a Wowza Streaming Engine.

I've built my own implementation, exchange SDP offer/answer, no errors, but the exchange halts in the Ice State Checking.

This also works as expected from Chrome via WebRTC to the Wowza Engine, so the issue does not appear to lie there.

Log error I'm getting

[019:110] [51467] (stunport.cc:282): Port[801a400:0:1:0:local:Net[en2:169.254.0.x/16:Wifi:id=1]]: UDP send of 100 bytes failed with error 65
[009:190] [52483] (port.cc:1731): Conn[7058e00:0:Net[en2:169.254.0.x/16:Wifi:id=3]:K1VeXnEm:1:0:local:udp:169.254.31.x:63068->u76s55ya:1:50:local:udp:52.7.176.x:6970|C--W|-|0|0|218992623103|-]: Sent STUN ping, id=66706566354b77567a55706a, use_candidate=0, nomination=0
[009:241] [52483] (port.cc:1731): Conn[503dc00:0:Net[pdp_ip0:10.233.207.x/32:Cellular:id=8]:Usd6n9/m:1:0:local:udp:10.233.207.x:61703->u76s55ya:1:50:local:udp:52.7.176.x:6970|C--W|-|0|0|218992229887|-]: Sent STUN ping, id=6431755a4674675155333050, use_candidate=0, nomination=0
[009:292] [52483] (port.cc:1731): Conn[7060e00:0:Net[en0:192.168.0.x/24:Wifi:id=1]:s9SLzrT3:1:0:local:udp:192.168.0.x:53334->u76s55ya:1:50:local:udp:52.7.176.x:6970|C--I|-|0|0|218992754175|-]: Sent STUN ping, id=496e57507237574d52324b50, use_candidate=0, nomination=0

Any help would be amazing!

EDIT: A more detailed flow.

I am attempting to create a peer connection between a Wowza Streaming Engine instance and WebRTC on iOS. The connection is only a publish, no streams are received.

My steps are as follows

  1. Peer connection created from the factory.
  2. Media streams added to the peer connection.
  3. Offer created on Peer connection.
  4. Offer set as local description and sent to Wowza. Offer has the local Ice Candadites
  5. Wowza response with the Answer SDP and the ice candidate (Wowza only gives one)
  6. Answer is set to Remote Description
  7. The single Ice Candidate is added into the Peer Connection

Final state is always RTCIceConnectionStateChecking then failed.

2

2 Answers

3
votes

You need to exchange (trickle) ICE candidates, or wait a few seconds before exchanging the SDP offer/answer, to give the local ICE agent time to populate the offer/answer with candidates (available by getting the local description).

0
votes

Perhaps somebody might run into this problem too on iOS. I would like to know as well how to make trickle work as it doesn't seem to work even iOS to iOS in my situation. But what's possible is that as the caller at the moment your connection goes to checking to send the offer again. In this second offer you will find all of the candidates as well. So this enables to trickling peers to connect while you send all of the candidates and the ones that don't to connect on the second offer.

Try to compare the offer that you generate straight away with the one you generate after you go to checking to see the difference.

func webRTCClient(_ client: WebRTCClient, didChangeConnectionState
state: RTCIceConnectionState)

If you get the state "checking" call:-

-(void)offerForConstraints:(RTCMediaConstraints *)constraints
completionHandler:(nullable void (^)(RTCSessionDescription *_Nullable sdp,
NSError *_Nullable error))completionHandler;