Introduces a CandidatePair factory method in Agent (to facilitate the tracking of the former's initialization).
This commit is contained in:
parent
ecc9e59564
commit
ed15e98916
@ -422,6 +422,28 @@ public class Agent
|
||||
return component;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new {@link CandidatePair} instance from a
|
||||
* {@link LocalCandidate} and a {@link RemoteCandidate}. The method
|
||||
* represents a {@code CandidatePair} factory and is preferable to
|
||||
* explicitly calling the {@code CandidatePair} constructor because it
|
||||
* allows this {@code Agent} to easily track the initialization of its
|
||||
* {@code CandidatePair}s.
|
||||
*
|
||||
* @param local the {@code LocalCandidate} to initialize the new instance
|
||||
* with
|
||||
* @param remote the {@code RemoteCandidate} to initialize the new instance
|
||||
* with
|
||||
* @return a new {@code CandidatePair} instance initializes with
|
||||
* {@code local} and {@code remote}
|
||||
*/
|
||||
protected CandidatePair createCandidatePair(
|
||||
LocalCandidate local,
|
||||
RemoteCandidate remote)
|
||||
{
|
||||
return new CandidatePair(local, remote);
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses all <tt>CandidateHarvester</tt>s currently registered with this
|
||||
* <tt>Agent</tt> to obtain whatever addresses they can discover.
|
||||
@ -1445,7 +1467,7 @@ public class Agent
|
||||
ufrag);
|
||||
|
||||
CandidatePair triggeredPair
|
||||
= new CandidatePair(localCandidate, remoteCandidate);
|
||||
= createCandidatePair(localCandidate, remoteCandidate);
|
||||
|
||||
logger.fine("set use-candidate " + useCandidate + " for pair " +
|
||||
triggeredPair.toShortString());
|
||||
|
||||
@ -289,7 +289,7 @@ public class Component
|
||||
*/
|
||||
public void updateRemoteCandidates()
|
||||
{
|
||||
List<CandidatePair> checkList = null;
|
||||
List<CandidatePair> checkList;
|
||||
List<RemoteCandidate> newRemoteCandidates;
|
||||
|
||||
synchronized(remoteUpdateCandidates)
|
||||
@ -342,7 +342,9 @@ public class Component
|
||||
*/
|
||||
|
||||
CandidatePair pair
|
||||
= new CandidatePair(localCnd, remoteCnd);
|
||||
= getParentStream()
|
||||
.getParentAgent()
|
||||
.createCandidatePair(localCnd, remoteCnd);
|
||||
logger.info("new Pair added: " + pair.toShortString());
|
||||
checkList.add(pair);
|
||||
}
|
||||
|
||||
@ -575,7 +575,9 @@ class ConnectivityCheckClient
|
||||
// by a STUN connectivity check.
|
||||
CandidatePair validPair
|
||||
= (existingPair == null)
|
||||
? new CandidatePair(validLocalCandidate, validRemoteCandidate)
|
||||
? parentAgent.createCandidatePair(
|
||||
validLocalCandidate,
|
||||
validRemoteCandidate)
|
||||
: existingPair;
|
||||
|
||||
// we synchronize here because the same pair object can be processed (in
|
||||
|
||||
@ -394,8 +394,9 @@ public class IceMediaStream
|
||||
if(localCnd.canReach(remoteCnd)
|
||||
&& remoteCnd.getTransportAddress().getPort() != 0)
|
||||
{
|
||||
CandidatePair pair = new CandidatePair(localCnd,
|
||||
remoteCnd);
|
||||
CandidatePair pair
|
||||
= getParentAgent()
|
||||
.createCandidatePair(localCnd, remoteCnd);
|
||||
checkList.add(pair);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user