client: force TCP if encryption is active

This commit is contained in:
aler9
2020-12-14 23:06:50 +01:00
parent 61318d7f96
commit 27636bc810
2 changed files with 14 additions and 1 deletions

View File

@@ -65,6 +65,7 @@ func (s clientConnState) String() string {
type ClientConn struct {
conf ClientConf
nconn net.Conn
isTLS bool
br *bufio.Reader
bw *bufio.Writer
session string
@@ -386,6 +387,12 @@ func (c *ClientConn) Setup(mode headers.TransportMode, track *Track,
var rtpListener *clientConnUDPListener
var rtcpListener *clientConnUDPListener
// always use TCP if encrypted
if c.isTLS {
v := StreamProtocolTCP
c.streamProtocol = &v
}
proto := func() StreamProtocol {
// protocol set by previous Setup()
if c.streamProtocol != nil {
@@ -397,7 +404,7 @@ func (c *ClientConn) Setup(mode headers.TransportMode, track *Track,
return *c.conf.StreamProtocol
}
// try udp
// try UDP
return StreamProtocolUDP
}()