Adds support for generations
This commit is contained in:
parent
5f4c05d699
commit
a10d5e6687
@ -201,7 +201,16 @@ public class Agent
|
|||||||
private TerminationThread terminationThread;
|
private TerminationThread terminationThread;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes an empty <tt>Agent</tt> with no streams, and no address.
|
* Some protocols, such as XMPP, need to be able to distinguish the separate
|
||||||
|
* ICE sessions that occur as a result of ICE restarts, which is why we need
|
||||||
|
* to keep track of generations. A generation is an index, starting at 0,
|
||||||
|
* that enables the parties to keep track of updates to the candidate
|
||||||
|
* throughout the life of the session.
|
||||||
|
*/
|
||||||
|
private int generation = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an empty <tt>Agent</tt> with no streams, and no address
|
||||||
*/
|
*/
|
||||||
public Agent()
|
public Agent()
|
||||||
{
|
{
|
||||||
@ -1435,4 +1444,28 @@ public class Agent
|
|||||||
|
|
||||||
setState(terminationState);
|
setState(terminationState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the current generation of this ICE Agent. A generation is an
|
||||||
|
* index, starting at 0, that enables the parties to keep track of updates
|
||||||
|
* to the candidate throughout the life of the session.
|
||||||
|
*
|
||||||
|
* @return the current generation of this ICE Agent
|
||||||
|
*/
|
||||||
|
public int getGeneration()
|
||||||
|
{
|
||||||
|
return generation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies the current generation of this ICE Agent. A generation is an
|
||||||
|
* index, starting at 0, that enables the parties to keep track of updates
|
||||||
|
* to the candidate throughout the life of the session.
|
||||||
|
*
|
||||||
|
* @param generation the current generation of this ICE Agent
|
||||||
|
*/
|
||||||
|
public void setGeneration(int generation)
|
||||||
|
{
|
||||||
|
this.generation = generation;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -294,4 +294,20 @@ public class StunCandidateHarvester
|
|||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a <tt>String</tt> representation of this harvester containing its
|
||||||
|
* type and server address.
|
||||||
|
*
|
||||||
|
* @return a <tt>String</tt> representation of this harvester containing its
|
||||||
|
* type and server address.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
String proto = (this instanceof TurnCandidateHarvester)
|
||||||
|
? "TURN"
|
||||||
|
: "STUN";
|
||||||
|
return proto + " harvester for srvr: " + this.stunServer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -279,8 +279,9 @@ public class Ice
|
|||||||
new TransportAddress(hostname, port, Transport.UDP),
|
new TransportAddress(hostname, port, Transport.UDP),
|
||||||
longTermCredential));
|
longTermCredential));
|
||||||
|
|
||||||
|
//STREAMS
|
||||||
createStream(rtpPort, "audio", agent);
|
createStream(rtpPort, "audio", agent);
|
||||||
// createStream(rtpPort + 2, "video", agent);
|
createStream(rtpPort + 2, "video", agent);
|
||||||
|
|
||||||
return agent;
|
return agent;
|
||||||
}
|
}
|
||||||
@ -320,12 +321,12 @@ public class Ice
|
|||||||
+ (endTime - startTime) +" ms");
|
+ (endTime - startTime) +" ms");
|
||||||
startTime = endTime;
|
startTime = endTime;
|
||||||
//rtcpComp
|
//rtcpComp
|
||||||
// agent.createComponent(
|
agent.createComponent(
|
||||||
// stream, Transport.UDP, rtpPort + 1, rtpPort + 1, rtpPort + 101);
|
stream, Transport.UDP, rtpPort + 1, rtpPort + 1, rtpPort + 101);
|
||||||
|
|
||||||
// endTime = System.currentTimeMillis();
|
endTime = System.currentTimeMillis();
|
||||||
// System.out.println("RTCP Component created in "
|
System.out.println("RTCP Component created in "
|
||||||
// + (endTime - startTime) +" ms");
|
+ (endTime - startTime) +" ms");
|
||||||
|
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user