Add flag to control candidate fallback when udp unstable (#1630)
* Add flag to control candidate fallback when udp unstable * Don't close rtcpreader if downtrack will be resumed
This commit is contained in:
+16
-14
@@ -81,6 +81,7 @@ type ParticipantParams struct {
|
|||||||
AdaptiveStream bool
|
AdaptiveStream bool
|
||||||
AllowTCPFallback bool
|
AllowTCPFallback bool
|
||||||
TCPFallbackRTTThreshold int
|
TCPFallbackRTTThreshold int
|
||||||
|
AllowUDPUnstableFallback bool
|
||||||
TURNSEnabled bool
|
TURNSEnabled bool
|
||||||
GetParticipantInfo func(pID livekit.ParticipantID) *livekit.ParticipantInfo
|
GetParticipantInfo func(pID livekit.ParticipantID) *livekit.ParticipantInfo
|
||||||
ReconnectOnPublicationError bool
|
ReconnectOnPublicationError bool
|
||||||
@@ -977,20 +978,21 @@ func (p *ParticipantImpl) setupTransportManager() error {
|
|||||||
SID: p.params.SID,
|
SID: p.params.SID,
|
||||||
// primary connection does not change, canSubscribe can change if permission was updated
|
// primary connection does not change, canSubscribe can change if permission was updated
|
||||||
// after the participant has joined
|
// after the participant has joined
|
||||||
SubscriberAsPrimary: p.ProtocolVersion().SubscriberAsPrimary() && p.CanSubscribe(),
|
SubscriberAsPrimary: p.ProtocolVersion().SubscriberAsPrimary() && p.CanSubscribe(),
|
||||||
Config: p.params.Config,
|
Config: p.params.Config,
|
||||||
ProtocolVersion: p.params.ProtocolVersion,
|
ProtocolVersion: p.params.ProtocolVersion,
|
||||||
Telemetry: p.params.Telemetry,
|
Telemetry: p.params.Telemetry,
|
||||||
CongestionControlConfig: p.params.CongestionControlConfig,
|
CongestionControlConfig: p.params.CongestionControlConfig,
|
||||||
EnabledCodecs: p.params.EnabledCodecs,
|
EnabledCodecs: p.params.EnabledCodecs,
|
||||||
SimTracks: p.params.SimTracks,
|
SimTracks: p.params.SimTracks,
|
||||||
ClientConf: p.params.ClientConf,
|
ClientConf: p.params.ClientConf,
|
||||||
ClientInfo: p.params.ClientInfo,
|
ClientInfo: p.params.ClientInfo,
|
||||||
Migration: p.params.Migration,
|
Migration: p.params.Migration,
|
||||||
AllowTCPFallback: p.params.AllowTCPFallback,
|
AllowTCPFallback: p.params.AllowTCPFallback,
|
||||||
TCPFallbackRTTThreshold: p.params.TCPFallbackRTTThreshold,
|
TCPFallbackRTTThreshold: p.params.TCPFallbackRTTThreshold,
|
||||||
TURNSEnabled: p.params.TURNSEnabled,
|
AllowUDPUnstableFallback: p.params.AllowUDPUnstableFallback,
|
||||||
Logger: p.params.Logger,
|
TURNSEnabled: p.params.TURNSEnabled,
|
||||||
|
Logger: p.params.Logger,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
+18
-17
@@ -34,22 +34,23 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type TransportManagerParams struct {
|
type TransportManagerParams struct {
|
||||||
Identity livekit.ParticipantIdentity
|
Identity livekit.ParticipantIdentity
|
||||||
SID livekit.ParticipantID
|
SID livekit.ParticipantID
|
||||||
SubscriberAsPrimary bool
|
SubscriberAsPrimary bool
|
||||||
Config *WebRTCConfig
|
Config *WebRTCConfig
|
||||||
ProtocolVersion types.ProtocolVersion
|
ProtocolVersion types.ProtocolVersion
|
||||||
Telemetry telemetry.TelemetryService
|
Telemetry telemetry.TelemetryService
|
||||||
CongestionControlConfig config.CongestionControlConfig
|
CongestionControlConfig config.CongestionControlConfig
|
||||||
EnabledCodecs []*livekit.Codec
|
EnabledCodecs []*livekit.Codec
|
||||||
SimTracks map[uint32]SimulcastTrackInfo
|
SimTracks map[uint32]SimulcastTrackInfo
|
||||||
ClientConf *livekit.ClientConfiguration
|
ClientConf *livekit.ClientConfiguration
|
||||||
ClientInfo ClientInfo
|
ClientInfo ClientInfo
|
||||||
Migration bool
|
Migration bool
|
||||||
AllowTCPFallback bool
|
AllowTCPFallback bool
|
||||||
TCPFallbackRTTThreshold int
|
TCPFallbackRTTThreshold int
|
||||||
TURNSEnabled bool
|
AllowUDPUnstableFallback bool
|
||||||
Logger logger.Logger
|
TURNSEnabled bool
|
||||||
|
Logger logger.Logger
|
||||||
}
|
}
|
||||||
|
|
||||||
type TransportManager struct {
|
type TransportManager struct {
|
||||||
@@ -710,7 +711,7 @@ func (t *TransportManager) OnReceiverReport(dt *sfu.DownTrack, report *rtcp.Rece
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (t *TransportManager) onMediaLossUpdate(loss uint8) {
|
func (t *TransportManager) onMediaLossUpdate(loss uint8) {
|
||||||
if t.params.TCPFallbackRTTThreshold == 0 {
|
if t.params.TCPFallbackRTTThreshold == 0 || !t.params.AllowUDPUnstableFallback {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
t.lock.Lock()
|
t.lock.Lock()
|
||||||
|
|||||||
Reference in New Issue
Block a user