awslabs / amazon-kinesis-video-streams-webrtc-sdk-c

Amazon Kinesis Video Streams Webrtc SDK is for developers to install and customize realtime communication between devices and enable secure streaming of video, audio to Kinesis Video Streams.
https://awslabs.github.io/amazon-kinesis-video-streams-webrtc-sdk-c/group__PublicMemberFunctions.html
Apache License 2.0
1.03k stars 310 forks source link

[BUG] candidate stun srflx error #1723

Closed RTL8710 closed 1 year ago

RTL8710 commented 1 year ago

Logging 2023-06-06 08:10:14 DEBUG iceAgentGatherCandidateTimerCallback():1550 Candidate gathering completed. 2023-06-06 08:10:14 DEBUG iceAgentLogNewCandidate():2666 New local ice candidate discovered. Id: tLZvlRFQX. Ip: 119.143.79.165:35447. Type: srflx. Protocol: udp. 2023-06-06 08:10:14 DEBUG onIceCandidateHandler():587 onIceCandidateHandler candidateJson,pSampleStreamingSession->peerId = sessionSubscriber candidateJson : {"candidate":"candidate:2 1 udp 1694498815 119.143.79.165 35447 typ srflx raddr 0.0.0.0 rport 0 generation 0 network-cost 999","sdpMid":"0","sdpMLineIndex":0} 2023-06-06 08:10:14 DEBUG onIceCandidateHandler():605 onIceCandidateHandler SIGNALING_MESSAGE_TYPE_ICE_CANDIDATE to server 2023-06-06 08:10:14 WARN sendLwsMessage():1875 peerClientId = sessionSubscriber pCorrelationId = packTrickleRequest.target = sessionSubscriber packTrickleRequest.candidateinit = {"candidate":"candidate:2 1 udp 1694498815 119.143.79.165 35447 typ srflx raddr 0.0.0.0 rport 0 generation 0 network-cost 999","sdpMid":"0","sdpMLineIndex":0} pMessage = {"candidate":"candidate:2 1 udp 1694498815 119.143.79.165 35447 typ srflx raddr 0.0.0.0 rport 0 generation 0 network-cost 999","sdpMid":"0","sdpMLineIndex":0} messageLen = 158 strlen(pMessage) = 158 2023-06-06 08:10:14 DEBUG sendLwsMessage():2016 Sending data over web socket: Message type: ICE_CANDIDATE, LWS_PRE = 16 writtenSize = 166 peerClientId: sessionSubscriber pMessage = {"candidate":"candidate:2 1 udp 1694498815 119.143.79.165 35447 typ srflx raddr 0.0.0.0 rport 0 generation 0 network-cost 999","sdpMid":"0","sdpMLineIndex":0} 2023-06-06 08:10:14 DEBUG iceAgentLogNewCandidate():2666 New local ice candidate discovered. Id: FbYVjRX56. Ip: 119.143.79.165:35294. Type: srflx. Protocol: udp. 2023-06-06 08:10:14 DEBUG onIceCandidateHandler():587 onIceCandidateHandler candidateJson,pSampleStreamingSession->peerId = sessionSubscriber candidateJson : {"candidate":"candidate:1 1 udp 1694498815 119.143.79.165 35294 typ srflx raddr 0.0.0.0 rport 0 generation 0 network-cost 999","sdpMid":"0","sdpMLineIndex":0} 2023-06-06 08:10:14 DEBUG onIceCandidateHandler():605 onIceCandidateHandler SIGNALING_MESSAGE_TYPE_ICE_CANDIDATE to server 2023-06-06 08:10:14 WARN sendLwsMessage():1875 peerClientId = sessionSubscriber pCorrelationId = packTrickleRequest.target = sessionSubscriber packTrickleRequest.candidateinit = {"candidate":"candidate:1 1 udp 1694498815 119.143.79.165 35294 typ srflx raddr 0.0.0.0 rport 0 generation 0 network-cost 999","sdpMid":"0","sdpMLineIndex":0} pMessage = {"candidate":"candidate:1 1 udp 1694498815 119.143.79.165 35294 typ srflx raddr 0.0.0.0 rport 0 generation 0 network-cost 999","sdpMid":"0","sdpMLineIndex":0} messageLen = 158 strlen(pMessage) = 158 2023-06-06 08:10:14 DEBUG sendLwsMessage():2016 Sending data over web socket: Message type: ICE_CANDIDATE, LWS_PRE = 16 writtenSize = 166 peerClientId: sessionSubscriber pMessage = {"candidate":"candidate:1 1 udp 1694498815 119.143.79.165 35294 typ srflx raddr 0.0.0.0 rport 0 generation 0 network-cost 999","sdpMid":"0","sdpMLineIndex":0} 2023-06-06 08:10:14 DEBUG onIceCandidateHandler():587 onIceCandidateHandler candidateJson,pSampleStreamingSession->peerId = sessionSubscriber candidateJson : (null) 2023-06-06 08:10:14 DEBUG onIceCandidateHandler():589 ice candidate gathering finished 2023-06-06 08:10:14 VERBOSE stepStateMachine(): State Machine - Current state: 0x0000000000000002, Next state: 0x0000000000000002, Current local state retry count [1], Max local state retry count [0], State transition wait time [0] ms 2023-06-06 08:10:14 VERBOSE stepStateMachine(): State Machine - Current state: 0x0000000000000002, Next state: 0x0000000000000002, Current local state retry count [1], Max local state retry count [0], State transition wait time [0] ms 2023-06-06 08:10:14 WARN handleStunPacket():2447 Unable to fetch request Timestamp from the hash table. No update to totalRoundTripTime (error code: 0x40100001) 2023-06-06 08:10:14 ERROR handleStunPacket():2554 operation returned status code: 0x40100001 2023-06-06 08:10:14 ERROR incomingDataHandler():2312 operation returned status code: 0x40100001

Describe the bug How can I solve this question,tks?

RTL8710 commented 1 year ago

STATUS_CERTIFICATE_GENERATION_FAILED (0x40100001 ) ?

niyatim23 commented 1 year ago

Hi @RTL8710, I'm not clear as to what problem you're facing. The only errors I see are:

2023-06-06 08:10:14 WARN handleStunPacket():2447 Unable to fetch request Timestamp from the hash table. No update to totalRoundTripTime (error code: 0x40100001)
2023-06-06 08:10:14 ERROR handleStunPacket():2554 operation returned status code: 0x40100001
2023-06-06 08:10:14 ERROR incomingDataHandler():2312 operation returned status code: 0x40100001

The error code comes from one of the dependencies of our SDK here. These can be safely ignored. Can you please elaborate further on the issue you're facing? Are you able to see the stream on the JS viewer when you use the sample?

RTL8710 commented 1 year ago

2023-06-06 13:27:09 VERBOSE stepStateMachine(): State Machine - Current state: 0x0000000000000002, Next state: 0x0000000000000002, Current local state retry count [1], Max local state retry count [0], State transition wait time [0] ms 2023-06-06 13:27:09 DEBUG iceAgentLogNewCandidate():2669 New local ice candidate discovered. Id: vp/Ieasr+. Ip: 119.143.79.165:35431. Type: srflx. Protocol: udp. 2023-06-06 13:27:09 DEBUG onIceCandidateHandler():587 onIceCandidateHandler candidateJson,pSampleStreamingSession->peerId = sessionSubscriber candidateJson : {"candidate":"candidate:2 1 udp 1694498815 119.143.79.165 35431 typ srflx raddr 0.0.0.0 rport 0 generation 0 network-cost 999","sdpMid":"0","sdpMLineIndex":0} 2023-06-06 13:27:09 DEBUG onIceCandidateHandler():605 onIceCandidateHandler SIGNALING_MESSAGE_TYPE_ICE_CANDIDATE to server 2023-06-06 13:27:09 WARN sendLwsMessage():1875 peerClientId = sessionSubscriber pCorrelationId = packTrickleRequest.target = sessionSubscriber packTrickleRequest.candidateinit = {"candidate":"candidate:2 1 udp 1694498815 119.143.79.165 35431 typ srflx raddr 0.0.0.0 rport 0 generation 0 network-cost 999","sdpMid":"0","sdpMLineIndex":0} pMessage = {"candidate":"candidate:2 1 udp 1694498815 119.143.79.165 35431 typ srflx raddr 0.0.0.0 rport 0 generation 0 network-cost 999","sdpMid":"0","sdpMLineIndex":0} messageLen = 158 strlen(pMessage) = 158 2023-06-06 13:27:09 DEBUG sendLwsMessage():2016 Sending data over web socket: Message type: ICE_CANDIDATE, LWS_PRE = 16 writtenSize = 166 peerClientId: sessionSubscriber pMessage = {"candidate":"candidate:2 1 udp 1694498815 119.143.79.165 35431 typ srflx raddr 0.0.0.0 rport 0 generation 0 network-cost 999","sdpMid":"0","sdpMLineIndex":0} 2023-06-06 13:27:09 VERBOSE stepStateMachine(): State Machine - Current state: 0x0000000000000002, Next state: 0x0000000000000002, Current local state retry count [1], Max local state retry count [0], State transition wait time [0] ms 2023-06-06 13:27:09 WARN handleStunPacket():2450 Unable to fetch request Timestamp from the hash table. No update to totalRoundTripTime (error code: 0x40100001) 2023-06-06 13:27:09 ERROR handleStunPacket():2557 operation returned status code: 0x40100001 2023-06-06 13:27:09 ERROR incomingDataHandler():2315 operation returned status code: 0x40100001 2023-06-06 13:27:09 DEBUG iceAgentGatherCandidateTimerCallback():1553 Candidate gathering completed. 2023-06-06 13:27:09 DEBUG iceAgentLogNewCandidate():2669 New local ice candidate discovered. Id: HRK2wFrQn. Ip: 119.143.79.165:35299. Type: srflx. Protocol: udp. 2023-06-06 13:27:09 DEBUG onIceCandidateHandler():587 onIceCandidateHandler candidateJson,pSampleStreamingSession->peerId = sessionSubscriber candidateJson : {"candidate":"candidate:1 1 udp 1694498815 119.143.79.165 35299 typ srflx raddr 0.0.0.0 rport 0 generation 0 network-cost 999","sdpMid":"0","sdpMLineIndex":0} 2023-06-06 13:27:09 DEBUG onIceCandidateHandler():605 onIceCandidateHandler SIGNALING_MESSAGE_TYPE_ICE_CANDIDATE to server 2023-06-06 13:27:09 WARN sendLwsMessage():1875 peerClientId = sessionSubscriber pCorrelationId = packTrickleRequest.target = sessionSubscriber packTrickleRequest.candidateinit = {"candidate":"candidate:1 1 udp 1694498815 119.143.79.165 35299 typ srflx raddr 0.0.0.0 rport 0 generation 0 network-cost 999","sdpMid":"0","sdpMLineIndex":0} pMessage = {"candidate":"candidate:1 1 udp 1694498815 119.143.79.165 35299 typ srflx raddr 0.0.0.0 rport 0 generation 0 network-cost 999","sdpMid":"0","sdpMLineIndex":0} messageLen = 158 strlen(pMessage) = 158 2023-06-06 13:27:09 DEBUG sendLwsMessage():2016 Sending data over web socket: Message type: ICE_CANDIDATE, LWS_PRE = 16 writtenSize = 166 peerClientId: sessionSubscriber pMessage = {"candidate":"candidate:1 1 udp 1694498815 119.143.79.165 35299 typ srflx raddr 0.0.0.0 rport 0 generation 0 network-cost 999","sdpMid":"0","sdpMLineIndex":0} 2023-06-06 13:27:09 DEBUG onIceCandidateHandler():587 onIceCandidateHandler candidateJson,pSampleStreamingSession->peerId = sessionSubscriber candidateJson : (null) 2023-06-06 13:27:09 DEBUG onIceCandidateHandler():589 ice candidate gathering finished 2023-06-06 13:27:09 WARN handleStunPacket():2450 Unable to fetch request Timestamp from the hash table. No update to totalRoundTripTime (error code: 0x40100001) 2023-06-06 13:27:09 ERROR handleStunPacket():2557 operation returned status code: 0x40100001 2023-06-06 13:27:09 ERROR incomingDataHandler():2315 operation returned status code: 0x40100001 2023-06-06 13:27:09 VERBOSE stepStateMachine(): State Machine - Current state: 0x0000000000000002, Next state: 0x0000000000000002, Current local state retry count [1], Max local state retry count [0], State transition wait time [0] ms 2023-06-06 13:27:09 WARN handleStunPacket():2450 Unable to fetch request Timestamp from the hash table. No update to totalRoundTripTime (error code: 0x40100001) 2023-06-06 13:27:09 ERROR handleStunPacket():2557 operation returned status code: 0x40100001 2023-06-06 13:27:09 ERROR incomingDataHandler():2315 operation returned status code: 0x40100001 2023-06-06 13:27:09 VERBOSE stepStateMachine(): State Machine - Current state: 0x0000000000000002, Next state: 0x0000000000000002, Current local state retry count [1], Max local state retry count [0], State transition wait time [0] ms 2023-06-06 13:27:09 VERBOSE stepStateMachine(): State Machine - Current state: 0x0000000000000002, Next state: 0x0000000000000002, Current local state retry count [1], Max local state retry count [0], State transition wait time [0] ms 2023-06-06 13:27:09 VERBOSE stepStateMachine(): State Machine - Current state: 0x0000000000000002, Next state: 0x0000000000000002, Current local state retry count [1], Max local state retry count [0], State transition wait time [0] ms 2023-06-06 13:27:09 VERBOSE stepStateMachine(): State Machine - Current state: 0x0000000000000002, Next state: 0x0000000000000002, Current local state retry count [1], Max local state retry count [0], State transition wait time [0] ms 2023-06-06 13:27:09 VERBOSE stepStateMachine(): State Machine - Current state: 0x0000000000000002, Next state: 0x0000000000000002, Current local state retry count [1], Max local state retry count [0], State transition wait time [0] ms 2

RTL8710 commented 1 year ago

don't see stream ,ICE error:

sirknightj commented 1 year ago

Could you provide us some more context on what steps were needed in order to encounter this error?

Was it previously working and now it is not working? Sometimes failing? Always failing?

Are you using master branch? Which device are you running this on? Any code changes you made? What are you using as viewer?

RTL8710 commented 1 year ago

candidate use server extend ip as views and device as master in host 。

RTL8710 commented 1 year ago

@niyatim23 @niyatim23 use master branch。 ice code not change, if device in local ,can see the stream。 but device use srflx ,offer ,answer,candidate signal command success ,but ICE iceAgentCheckCandidatePairConnection error,ICE_AGENT_STATE_MACHINE_STATES Always 0x0000000000000002。

RTL8710 commented 1 year ago

@niyatim23 @sirknightj @northteam @fernandoc1 picture is a screenshot of the data captured and analyzed by my device 8.218.190.76 is the server address where I deployed P2P (connectivity needs to be checked) 172.217.21.127 is my stun server address (used to collect candidates) How to solve the problem of a device's Binding request not responding to a Binding response tks?

image

RTL8710 commented 1 year ago

How to set the livekit server to ice full mode?

niyatim23 commented 1 year ago

Hi @RTL8710, I wonder if your network setup supports STUN. Can you please run the discoverNatBehavior from our samples to understand what is suitable path? Have you disabled TURN? Do you see any stream when you use TURN?