Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Active TCP candidates? #562

Closed
ahaooahaz opened this issue Apr 21, 2023 · 7 comments
Closed

Active TCP candidates? #562

ahaooahaz opened this issue Apr 21, 2023 · 7 comments

Comments

@ahaooahaz
Copy link

ahaooahaz commented Apr 21, 2023

In some cases, I will use Pion instead of the browser as the client to push data to the server. When the server only supports tcp-type ice links, the candidate address generated by Pion needs to be an active-mode tcp address. Tried examples/ice-tcp, the current tcp candidate addresses only include passive mode addresses, and I didn’t find any configuration items that can change this.

The phenomenon I encountered is that Pion generates tcp passive candidate addresses, and the server’s candidate addresses only have tcp passive mode, and they always fail to connect.

When I use the browser as a client, it generates tcp's active mode candidates and works fine.

I guess the reason for the inability to connect may be related to the active mode and passive mode. I am sorry that I am a novice in webrtc, and I am not very clear about some underlying principles.

If Pion already supports this function, can you tell me how to make this function take effect?

Thanks.

@stv0g stv0g changed the title active ICE TCP candidates? Active TCP candidates? Apr 25, 2023
@stv0g
Copy link
Member

stv0g commented Apr 25, 2023

Hi @ahaooahaz,

I will move this issue to the pion/ice repo as this is ICE related.

@stv0g stv0g transferred this issue from pion/webrtc Apr 25, 2023
@ashellunts
Copy link
Contributor

ashellunts commented May 7, 2023

Hi @ahaooahaz, it is not supported yet.
Here is draft PR for the feature: #565

@stv0g
Copy link
Member

stv0g commented May 15, 2023

#565 has been merged. 🥳

@stv0g stv0g closed this as completed May 15, 2023
@Sean-Der
Copy link
Member

@ahaooahaz I just tagged v3.2.3 which has Active TCP support, would you mind testing it out. Thank you!

@ahaooahaz
Copy link
Author

@Sean-Der @stv0g @ashellunts Great works!

I has tested publish video to TCP-only webrtc server, I can see the ICE-TCP connected, but when transport SRTP packets there always auth failed.

here is the TCP-only server logs which publish client is pion/[email protected]:

2023-05-19 03:04:50.473 D [MediaServer] [7-event poller 3] DtlsTransport.cpp:1018 SendPendingOutgoingDtlsData | 75 bytes of DTLS data ready to sent to the peer
2023-05-19 03:04:50.473 D [MediaServer] [7-event poller 3] DtlsTransport.cpp:1207 CheckRemoteFingerprint | valid remote fingerprint
2023-05-19 03:04:50.473 D [MediaServer] [7-event poller 3] DtlsTransport.cpp:1381 GetNegotiatedSrtpCryptoSuite | chosen SRTP crypto suite: SRTP_AEAD_AES_256_GCM 
2023-05-19 03:04:50.473 I [MediaServer] [7-event poller 3] WebRtcTransport.cpp:137 OnDtlsTransportConnected | 
2023-05-19 03:04:50.474 D [MediaServer] [7-event poller 3] DtlsTransport.cpp:1056 SetTimeout | DTLS timer set in 99ms
2023-05-19 03:04:50.490 W [MediaServer] [7-event poller 3] SrtpSession.cpp:246 DecryptSrtp | srtp_unprotect() failed:authentication failure (srtp_err_status_auth_fail)
2023-05-19 03:04:50.490 W [MediaServer] [7-event poller 3] SrtpSession.cpp:246 DecryptSrtp | srtp_unprotect() failed:authentication failure (srtp_err_status_auth_fail)

here is the TCP-only server logs which publish client is Chrome:

2023-05-19 03:09:32.697 D [MediaServer] [7-event poller 3] DtlsTransport.cpp:1456 OnSslInfo | DTLS handshake done                                                                                                     
2023-05-19 03:09:32.697 D [MediaServer] [7-event poller 3] DtlsTransport.cpp:1018 SendPendingOutgoingDtlsData | 67 bytes of DTLS data ready to sent to the peer
2023-05-19 03:09:32.697 D [MediaServer] [7-event poller 3] DtlsTransport.cpp:1207 CheckRemoteFingerprint | valid remote fingerprint                                                                                   
2023-05-19 03:09:32.697 D [MediaServer] [7-event poller 3] DtlsTransport.cpp:1381 GetNegotiatedSrtpCryptoSuite | chosen SRTP crypto suite: SRTP_AEAD_AES_256_GCM                                                      
2023-05-19 03:09:32.697 I [MediaServer] [7-event poller 3] WebRtcTransport.cpp:137 OnDtlsTransportConnected |                                                                                                         
2023-05-19 03:09:32.697 D [MediaServer] [7-event poller 3] DtlsTransport.cpp:1056 SetTimeout | DTLS timer set in 99ms                                                                                                 
2023-05-19 03:09:32.796 D [MediaServer] [7-event poller 3] DtlsTransport.cpp:1472 OnTimer | handshake is done so return                                                                                               
2023-05-19 03:09:32.846 W [MediaServer] [7-event poller 3] WebRtcTransport.cpp:923 inputRtp | unknown rtx rtp, rid:, ssrc:1590349209, codec:H264, seq:5814                                                            
2023-05-19 03:09:32.848 I [MediaServer] [7-event poller 3] WebRtcTransport.cpp:866 createRtpChannel | create rtp receiver of ssrc:1062276153, rid:, codec:H264                                                        
2023-05-19 03:09:32.850 D [MediaServer] [7-event poller 3] MediaSink.cpp:137 emitAllTrackReady | all track ready use 153ms
2023-05-19 03:09:32.850 T [MediaServer] [7-event poller 3] MediaSink.cpp:259 addMuteAudioTrack | mute aac track added
2023-05-19 03:09:32.850 I [MediaServer] [7-event poller 3] MultiMediaSourceMuxer.cpp:368 onAllTrackReady | stream: rtc://127.0.0.1:80/1/2?app=1&stream=2&type=push&session=43-72 , codec info: mpeg4-generic[8000/1/16] H264[320/180/0] 
2023-05-19 03:09:32.856 I [MediaServer] [7-event poller 3] MediaSource.cpp:523 emitEvent | 媒体注册:rtmp://__defaultVhost__/1/2
2023-05-19 03:09:32.856 I [MediaServer] [7-event poller 3] MediaSource.cpp:523 emitEvent | 媒体注册:rtsp://__defaultVhost__/1/2
2023-05-19 03:09:32.896 D [MediaServer] [7-event poller 3] DtlsTransport.cpp:1472 OnTimer | handshake is done so return
2023-05-19 03:09:33.492 D [MediaServer] [7-event poller 3] DtlsTransport.cpp:1472 OnTimer | handshake is done so return

@Sean-Der
Copy link
Member

Hi @ahaooahaz would you please try again with v3.2.4

I believe you hit an unrelated bug. thank you!

@ahaooahaz
Copy link
Author

@Sean-Der I changed to v3.2.4 and it works! 🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants