Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Webrtc media over tcp?

I am new to WebRTC.

I was learned about the turn server.

The below thing is used to configure the turn server works on TCP for a webrtc application.

Example turn server configuration in webrtc application :-

{

       url: ‘turn:192.158.29.39:3478?transport=tcp’,  
       credential: ‘JZEOEt2V3Qb0y27GRntt2u2PAYA=’,
       username: ‘28224511:1379330808′

}

The meaning for the ?transport=tcp is it works on TCP protocol like that they said.

My question is,

The turn server works on TCP means, it is only for establishing a connection between turn server it works on TCP or for transferring a WebRTC media via turn server it uses the TCP protocol. For which purpose the TCP packet is used ?

Is it possible to transfer the WebRTC media via the TCP packet ?

like image 312
sureshkumar Avatar asked Jun 19 '17 09:06

sureshkumar


1 Answers

Forcing WebRTC media over TCP is not recommended, its just a fallback option for strict firewalls.

If you specify ?transport=tcp in TURN urls, then WebRTC client will connect to TURN Server over TCP.
Clients will send STUN requests over TCP to allocate relay candidates (As far as i know, currently chrome/firefox only request UDP relay candidates).

To force strict TCP via TURN server:

  • Use only TURN url with ?transport=tcp
  • Specify iceTransportPolicy:"relay", so that all media will flow via TURN

After exchanging the relay candidates(udp) between peerConnections, the media path will be as below

P1 <--TCP--> P1TURN <--UDP--> P2TURN <--TCP--> P2

If both P1TURN & P2TURN are always same, then you can choose TURN relay path as LAN/lo interface i.e. you will get UDP relay candidates with LAN/lo IP.

If you want to avoid UDP & two times TURN in the media path, you need to use some SFU/SVC like Jitsi(supports pseudo-SSL candidates)/Janus.
Then media path will be as below

P1 <--TCP--> SFU/MCU <--TCP--> P2

like image 65
Ajay Avatar answered Nov 14 '22 08:11

Ajay