Uses IceLite only for protocol 6 clients (#397)

* Update to Pion v3.1.20, with fixes DTLS role ambiguity

* Gate ice-lite on protocol version

Co-authored-by: boks1971 <raja.gobi@tutanota.com>
This commit is contained in:
David Zhao
2022-02-02 21:16:08 -08:00
committed by GitHub
co-authored by boks1971
parent ede39fe87f
commit a8d43aab67
7 changed files with 44 additions and 36 deletions
-12
View File
@@ -63,18 +63,6 @@ func NewWebRTCConfig(conf *config.Config, externalIP string) (*WebRTCConfig, err
s := webrtc.SettingEngine{
LoggerFactory: logging.NewLoggerFactory(logger.GetLogger()),
}
s.SetLite(true)
//
// This introduces a half-RTT extra latency in connection setup,
// i. e. if SFU is acting as DTLSRoleClient, it can send the client-hello as soon
// as it is ready. With this change, signalling has to be sent back to the client
// and client has to do client-hello which adds half RTT.
//
// Doing this to address https://github.com/pion/webrtc/issues/2089. This may be
// a Chrome browser issue and can potentially be removed once we understand the source
// of the issue better.
//
s.SetAnsweringDTLSRole(webrtc.DTLSRoleServer)
if externalIP != "" {
s.SetNAT1To1IPs([]string{externalIP}, webrtc.ICECandidateTypeHost)
+2
View File
@@ -145,6 +145,7 @@ func NewParticipant(params ParticipantParams, perms *livekit.ParticipantPermissi
p.publisher, err = NewPCTransport(TransportParams{
ParticipantID: p.params.SID,
ParticipantIdentity: p.params.Identity,
ProtocolVersion: p.ProtocolVersion(),
Target: livekit.SignalTarget_PUBLISHER,
Config: params.Config,
CongestionControlConfig: params.CongestionControlConfig,
@@ -159,6 +160,7 @@ func NewParticipant(params ParticipantParams, perms *livekit.ParticipantPermissi
p.subscriber, err = NewPCTransport(TransportParams{
ParticipantID: p.params.SID,
ParticipantIdentity: p.params.Identity,
ProtocolVersion: p.ProtocolVersion(),
Target: livekit.SignalTarget_SUBSCRIBER,
Config: params.Config,
CongestionControlConfig: params.CongestionControlConfig,
+15
View File
@@ -65,6 +65,7 @@ type PCTransport struct {
type TransportParams struct {
ParticipantID livekit.ParticipantID
ParticipantIdentity livekit.ParticipantIdentity
ProtocolVersion types.ProtocolVersion
Target livekit.SignalTarget
Config *WebRTCConfig
CongestionControlConfig config.CongestionControlConfig
@@ -107,6 +108,20 @@ func newPeerConnection(params TransportParams, onBandwidthEstimator func(estimat
//
se.DisableSRTPReplayProtection(true)
se.DisableSRTCPReplayProtection(true)
if params.ProtocolVersion.SupportsICELite() {
se.SetLite(true)
}
//
// This introduces a half-RTT extra latency in connection setup,
// i. e. if SFU is acting as DTLSRoleClient, it can send the client-hello as soon
// as it is ready. With this change, signalling has to be sent back to the client
// and client has to do client-hello which adds half RTT.
//
// Doing this to address https://github.com/pion/webrtc/issues/2089. This may be
// a Chrome browser issue and can potentially be removed once we understand the source
// of the issue better.
//
se.SetAnsweringDTLSRole(webrtc.DTLSRoleServer)
lf := serverlogger.NewLoggerFactory(logr.Logger(params.Logger))
if lf != nil {
+4
View File
@@ -39,3 +39,7 @@ func (v ProtocolVersion) SupportsConnectionQuality() bool {
func (v ProtocolVersion) SupportsSessionMigrate() bool {
return v > 5
}
func (v ProtocolVersion) SupportsICELite() bool {
return v > 5
}