mirror of
https://github.com/pion/webrtc.git
synced 2025-12-24 11:51:03 +08:00
Expose new ICE options
Expose new ICE timeouts in the setting engine
This commit is contained in:
committed by
Sean DuBois
parent
1314abb157
commit
8572527a86
@@ -40,6 +40,11 @@ func (api *API) NewICEGatherer(opts ICEGatherOptions) (*ICEGatherer, error) {
|
||||
api.settingEngine.ephemeralUDP.PortMax,
|
||||
api.settingEngine.timeout.ICEConnection,
|
||||
api.settingEngine.timeout.ICEKeepalive,
|
||||
api.settingEngine.timeout.ICECandidateSelectionTimeout,
|
||||
api.settingEngine.timeout.ICEHostAcceptanceMinWait,
|
||||
api.settingEngine.timeout.ICESrflxAcceptanceMinWait,
|
||||
api.settingEngine.timeout.ICEPrflxAcceptanceMinWait,
|
||||
api.settingEngine.timeout.ICERelayAcceptanceMinWait,
|
||||
api.settingEngine.LoggerFactory,
|
||||
api.settingEngine.candidates.ICENetworkTypes,
|
||||
opts,
|
||||
|
||||
@@ -24,14 +24,19 @@ type Gatherer struct {
|
||||
agentIsTrickle bool
|
||||
agent *ice.Agent
|
||||
|
||||
portMin uint16
|
||||
portMax uint16
|
||||
candidateTypes []ice.CandidateType
|
||||
connectionTimeout *time.Duration
|
||||
keepaliveInterval *time.Duration
|
||||
loggerFactory logging.LoggerFactory
|
||||
log logging.LeveledLogger
|
||||
networkTypes []NetworkType
|
||||
portMin uint16
|
||||
portMax uint16
|
||||
candidateTypes []ice.CandidateType
|
||||
connectionTimeout *time.Duration
|
||||
keepaliveInterval *time.Duration
|
||||
candidateSelectionTimeout *time.Duration
|
||||
hostAcceptanceMinWait *time.Duration
|
||||
srflxAcceptanceMinWait *time.Duration
|
||||
prflxAcceptanceMinWait *time.Duration
|
||||
relayAcceptanceMinWait *time.Duration
|
||||
loggerFactory logging.LoggerFactory
|
||||
log logging.LeveledLogger
|
||||
networkTypes []NetworkType
|
||||
|
||||
onLocalCandidateHdlr func(candidate *Candidate)
|
||||
onStateChangeHdlr func(state GathererState)
|
||||
@@ -41,8 +46,13 @@ type Gatherer struct {
|
||||
func NewGatherer(
|
||||
portMin uint16,
|
||||
portMax uint16,
|
||||
connectionTimeout *time.Duration,
|
||||
keepaliveInterval *time.Duration,
|
||||
connectionTimeout,
|
||||
keepaliveInterval,
|
||||
candidateSelectionTimeout,
|
||||
hostAcceptanceMinWait,
|
||||
srflxAcceptanceMinWait,
|
||||
prflxAcceptanceMinWait,
|
||||
relayAcceptanceMinWait *time.Duration,
|
||||
loggerFactory logging.LoggerFactory,
|
||||
networkTypes []NetworkType,
|
||||
opts GatherOptions,
|
||||
@@ -64,16 +74,21 @@ func NewGatherer(
|
||||
}
|
||||
|
||||
return &Gatherer{
|
||||
state: GathererStateNew,
|
||||
validatedServers: validatedServers,
|
||||
portMin: portMin,
|
||||
portMax: portMax,
|
||||
connectionTimeout: connectionTimeout,
|
||||
keepaliveInterval: keepaliveInterval,
|
||||
loggerFactory: loggerFactory,
|
||||
log: loggerFactory.NewLogger("ice"),
|
||||
networkTypes: networkTypes,
|
||||
candidateTypes: candidateTypes,
|
||||
state: GathererStateNew,
|
||||
validatedServers: validatedServers,
|
||||
portMin: portMin,
|
||||
portMax: portMax,
|
||||
connectionTimeout: connectionTimeout,
|
||||
keepaliveInterval: keepaliveInterval,
|
||||
loggerFactory: loggerFactory,
|
||||
log: loggerFactory.NewLogger("ice"),
|
||||
networkTypes: networkTypes,
|
||||
candidateTypes: candidateTypes,
|
||||
candidateSelectionTimeout: candidateSelectionTimeout,
|
||||
hostAcceptanceMinWait: hostAcceptanceMinWait,
|
||||
srflxAcceptanceMinWait: srflxAcceptanceMinWait,
|
||||
prflxAcceptanceMinWait: prflxAcceptanceMinWait,
|
||||
relayAcceptanceMinWait: relayAcceptanceMinWait,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -91,14 +106,19 @@ func (g *Gatherer) createAgent() error {
|
||||
}
|
||||
|
||||
config := &ice.AgentConfig{
|
||||
Trickle: agentIsTrickle,
|
||||
Urls: g.validatedServers,
|
||||
PortMin: g.portMin,
|
||||
PortMax: g.portMax,
|
||||
ConnectionTimeout: g.connectionTimeout,
|
||||
KeepaliveInterval: g.keepaliveInterval,
|
||||
LoggerFactory: g.loggerFactory,
|
||||
CandidateTypes: g.candidateTypes,
|
||||
Trickle: agentIsTrickle,
|
||||
Urls: g.validatedServers,
|
||||
PortMin: g.portMin,
|
||||
PortMax: g.portMax,
|
||||
ConnectionTimeout: g.connectionTimeout,
|
||||
KeepaliveInterval: g.keepaliveInterval,
|
||||
LoggerFactory: g.loggerFactory,
|
||||
CandidateTypes: g.candidateTypes,
|
||||
CandidateSelectionTimeout: g.candidateSelectionTimeout,
|
||||
HostAcceptanceMinWait: g.hostAcceptanceMinWait,
|
||||
SrflxAcceptanceMinWait: g.srflxAcceptanceMinWait,
|
||||
PrflxAcceptanceMinWait: g.prflxAcceptanceMinWait,
|
||||
RelayAcceptanceMinWait: g.relayAcceptanceMinWait,
|
||||
}
|
||||
|
||||
requestedNetworkTypes := g.networkTypes
|
||||
|
||||
@@ -22,7 +22,7 @@ func TestGatherer_Success(t *testing.T) {
|
||||
ICEServers: []Server{{URLs: []string{"stun:stun.l.google.com:19302"}}},
|
||||
}
|
||||
|
||||
gatherer, err := NewGatherer(0, 0, nil, nil, logging.NewDefaultLoggerFactory(), nil, opts)
|
||||
gatherer, err := NewGatherer(0, 0, nil, nil, nil, nil, nil, nil, nil, logging.NewDefaultLoggerFactory(), nil, opts)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
@@ -21,8 +21,13 @@ type SettingEngine struct {
|
||||
DataChannels bool
|
||||
}
|
||||
timeout struct {
|
||||
ICEConnection *time.Duration
|
||||
ICEKeepalive *time.Duration
|
||||
ICEConnection *time.Duration
|
||||
ICEKeepalive *time.Duration
|
||||
ICECandidateSelectionTimeout *time.Duration
|
||||
ICEHostAcceptanceMinWait *time.Duration
|
||||
ICESrflxAcceptanceMinWait *time.Duration
|
||||
ICEPrflxAcceptanceMinWait *time.Duration
|
||||
ICERelayAcceptanceMinWait *time.Duration
|
||||
}
|
||||
candidates struct {
|
||||
ICENetworkTypes []NetworkType
|
||||
|
||||
Reference in New Issue
Block a user