Adds a few methods necessary for adding remote candidates to stream components
This commit is contained in:
parent
60d6f4ebc1
commit
96c9a972f7
@ -322,4 +322,30 @@ public class Agent
|
|||||||
return mediaStreams.size();
|
return mediaStreams.size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a <tt>String</tt> representation of this agent.
|
||||||
|
*
|
||||||
|
* @return a <tt>String</tt> representation of this agent.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
StringBuffer buff = new StringBuffer("ICE Agent (stream-count=");
|
||||||
|
|
||||||
|
buff.append(getStreamCount()).append(" ice-pwd:").append(getPassword());
|
||||||
|
buff.append(getStreamCount()).append(" ice-ufrag:")
|
||||||
|
.append(getUserName());
|
||||||
|
buff.append("):\n");
|
||||||
|
|
||||||
|
List<IceMediaStream> streams = getStreams();
|
||||||
|
for(IceMediaStream stream : streams)
|
||||||
|
{
|
||||||
|
buff.append(stream.toString()).append("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return buff.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -141,14 +141,6 @@ public abstract class Candidate
|
|||||||
this.candidateType = type;
|
this.candidateType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the <tt>DatagramSocket</tt> associated with this <tt>Candidate</tt>.
|
|
||||||
*
|
|
||||||
* @return the <tt>DatagramSocket</tt> associated with this
|
|
||||||
* <tt>Candidate</tt>
|
|
||||||
*/
|
|
||||||
public abstract DatagramSocket getSocket();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the type of this candidate which should be an instance of the
|
* Returns the type of this candidate which should be an instance of the
|
||||||
* {@link CandidateType} enumeration.
|
* {@link CandidateType} enumeration.
|
||||||
|
|||||||
@ -108,13 +108,13 @@ public class Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a local candidate to this component. The method has package access
|
* Add a local candidate to this component. The method should only be
|
||||||
* because local candidates can only be created and added by the candidate
|
* accessed and local candidates added by the candidate harvesters
|
||||||
* harvesters registered with the agent.
|
* registered with the agent.
|
||||||
*
|
*
|
||||||
* @param candidate the candidate object to be added
|
* @param candidate the candidate object to be added
|
||||||
*/
|
*/
|
||||||
protected void addLocalCandidate(Candidate candidate)
|
public void addLocalCandidate(Candidate candidate)
|
||||||
{
|
{
|
||||||
synchronized(localCandidates)
|
synchronized(localCandidates)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -25,7 +25,7 @@ import org.ice4j.*;
|
|||||||
*
|
*
|
||||||
* @author Emil Ivov
|
* @author Emil Ivov
|
||||||
*/
|
*/
|
||||||
public class HostCandidate extends Candidate
|
public class HostCandidate extends LocalCandidate
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,7 +59,7 @@ public class HostCandidate extends Candidate
|
|||||||
*
|
*
|
||||||
* @return the <tt>DatagramSocket</tt> associated with this
|
* @return the <tt>DatagramSocket</tt> associated with this
|
||||||
* <tt>Candidate</tt>
|
* <tt>Candidate</tt>
|
||||||
* @see Candidate#getSocket()
|
* @see LocalCandidate#getSocket()
|
||||||
*/
|
*/
|
||||||
public DatagramSocket getSocket()
|
public DatagramSocket getSocket()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -108,7 +108,20 @@ public class IceMediaStream
|
|||||||
*/
|
*/
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return "media stream:" + getName();
|
StringBuffer buff = new StringBuffer( "media stream:")
|
||||||
|
.append(getName());
|
||||||
|
buff.append(" (component count=").append(getComponentCount())
|
||||||
|
.append(")");
|
||||||
|
|
||||||
|
List<Component> components = getComponents();
|
||||||
|
for (Component cmp : components)
|
||||||
|
{
|
||||||
|
buff.append("Component ").append(cmp.getComponentID())
|
||||||
|
.append(" :\n");
|
||||||
|
buff.append(cmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buff.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -143,6 +156,21 @@ public class IceMediaStream
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of <tt>Component</tt>s currently registered with this
|
||||||
|
* stream.
|
||||||
|
*
|
||||||
|
* @return the number of <tt>Component</tt>s currently registered with this
|
||||||
|
* stream.
|
||||||
|
*/
|
||||||
|
public int getComponentCount()
|
||||||
|
{
|
||||||
|
synchronized(components)
|
||||||
|
{
|
||||||
|
return components.size();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the IDs of all <tt>Component</tt>s currently registered with this
|
* Returns the IDs of all <tt>Component</tt>s currently registered with this
|
||||||
* stream.
|
* stream.
|
||||||
|
|||||||
@ -38,16 +38,4 @@ public class RemoteCandidate
|
|||||||
{
|
{
|
||||||
super(transportAddress, parentComponent, type);
|
super(transportAddress, parentComponent, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Always returns null since remote candidates do not have a
|
|
||||||
* <tt>DatagramSocket</tt> associated with them.
|
|
||||||
*
|
|
||||||
* @return <tt>null</tt>
|
|
||||||
*/
|
|
||||||
public DatagramSocket getSocket()
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,7 @@ import org.ice4j.*;
|
|||||||
*
|
*
|
||||||
* @author Emil Ivov
|
* @author Emil Ivov
|
||||||
*/
|
*/
|
||||||
public class ServerReflexiveCandidate extends Candidate
|
public class ServerReflexiveCandidate extends LocalCandidate
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -55,10 +55,10 @@ public class ServerReflexiveCandidate extends Candidate
|
|||||||
*
|
*
|
||||||
* @return the <tt>DatagramSocket</tt> associated with this
|
* @return the <tt>DatagramSocket</tt> associated with this
|
||||||
* <tt>Candidate</tt>
|
* <tt>Candidate</tt>
|
||||||
* @see Candidate#getSocket()
|
* @see LocalCandidate#getSocket()
|
||||||
*/
|
*/
|
||||||
public DatagramSocket getSocket()
|
public DatagramSocket getSocket()
|
||||||
{
|
{
|
||||||
return getBase().getSocket();
|
return ((HostCandidate)getBase()).getSocket();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user