Adds to IceMediaStream several access methods that allow retrieving available components
This commit is contained in:
parent
296a88021a
commit
60d6f4ebc1
@ -269,9 +269,12 @@ public class Agent
|
|||||||
* <tt>null</tt> if no such stream has been registered with this
|
* <tt>null</tt> if no such stream has been registered with this
|
||||||
* <tt>Agent</tt> yet.
|
* <tt>Agent</tt> yet.
|
||||||
*/
|
*/
|
||||||
public IceMediaStream getMediaStream(String name)
|
public IceMediaStream getStream(String name)
|
||||||
{
|
{
|
||||||
return mediaStreams.get(name);
|
synchronized(mediaStreams)
|
||||||
|
{
|
||||||
|
return mediaStreams.get(name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -281,9 +284,12 @@ public class Agent
|
|||||||
* @return a <tt>List</tt> containing the names of all currently registered
|
* @return a <tt>List</tt> containing the names of all currently registered
|
||||||
* media streams.
|
* media streams.
|
||||||
*/
|
*/
|
||||||
public List<String> getMediaStreamNames()
|
public List<String> getStreamNames()
|
||||||
{
|
{
|
||||||
return new LinkedList<String>(mediaStreams.keySet());
|
synchronized(mediaStreams)
|
||||||
|
{
|
||||||
|
return new LinkedList<String>(mediaStreams.keySet());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -293,8 +299,27 @@ public class Agent
|
|||||||
* @return a <tt>List</tt> containing all <tt>IceMediaStream</tt>s currently
|
* @return a <tt>List</tt> containing all <tt>IceMediaStream</tt>s currently
|
||||||
* registered with this agent.
|
* registered with this agent.
|
||||||
*/
|
*/
|
||||||
public List<IceMediaStream> getMediaStreams()
|
public List<IceMediaStream> getStreams()
|
||||||
{
|
{
|
||||||
return new LinkedList<IceMediaStream>(mediaStreams.values());
|
synchronized(mediaStreams)
|
||||||
|
{
|
||||||
|
return new LinkedList<IceMediaStream>(mediaStreams.values());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of <tt>IceMediaStream</tt>s currently registered with
|
||||||
|
* this agent.
|
||||||
|
*
|
||||||
|
* @return the number of <tt>IceMediaStream</tt>s currently registered with
|
||||||
|
* this agent.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public int getStreamCount()
|
||||||
|
{
|
||||||
|
synchronized(mediaStreams)
|
||||||
|
{
|
||||||
|
return mediaStreams.size();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -169,7 +169,7 @@ public class Component
|
|||||||
* @return the number of all local candidates currently registered in this
|
* @return the number of all local candidates currently registered in this
|
||||||
* <tt>Component</tt>.
|
* <tt>Component</tt>.
|
||||||
*/
|
*/
|
||||||
public int countLocalCandidates()
|
public int getLocalCandidateCount()
|
||||||
{
|
{
|
||||||
synchronized(localCandidates)
|
synchronized(localCandidates)
|
||||||
{
|
{
|
||||||
@ -240,7 +240,7 @@ public class Component
|
|||||||
* @return the number of all remote candidates currently registered in this
|
* @return the number of all remote candidates currently registered in this
|
||||||
* <tt>Component</tt>.
|
* <tt>Component</tt>.
|
||||||
*/
|
*/
|
||||||
public int countRemoteCandidates()
|
public int getRemoteCandidateCount()
|
||||||
{
|
{
|
||||||
synchronized(remoteCandidates)
|
synchronized(remoteCandidates)
|
||||||
{
|
{
|
||||||
@ -297,7 +297,7 @@ public class Component
|
|||||||
buff.append(" parent stream=" + getParentStream().getName());
|
buff.append(" parent stream=" + getParentStream().getName());
|
||||||
|
|
||||||
//local candidates
|
//local candidates
|
||||||
int localCandidatesCount = countLocalCandidates();
|
int localCandidatesCount = getLocalCandidateCount();
|
||||||
|
|
||||||
if(localCandidatesCount > 0)
|
if(localCandidatesCount > 0)
|
||||||
{
|
{
|
||||||
@ -319,7 +319,7 @@ public class Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
//remote candidates
|
//remote candidates
|
||||||
int remoteCandidatesCount = countRemoteCandidates();
|
int remoteCandidatesCount = getRemoteCandidateCount();
|
||||||
|
|
||||||
if(remoteCandidatesCount > 0)
|
if(remoteCandidatesCount > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -81,8 +81,12 @@ public class IceMediaStream
|
|||||||
{
|
{
|
||||||
lastComponentID ++;
|
lastComponentID ++;
|
||||||
|
|
||||||
Component component = new Component(lastComponentID, transport, this);
|
Component component;
|
||||||
components.put(new Integer(lastComponentID), component);
|
synchronized( components )
|
||||||
|
{
|
||||||
|
component = new Component(lastComponentID, transport, this);
|
||||||
|
components.put(new Integer(lastComponentID), component);
|
||||||
|
}
|
||||||
|
|
||||||
return component;
|
return component;
|
||||||
}
|
}
|
||||||
@ -118,7 +122,10 @@ public class IceMediaStream
|
|||||||
*/
|
*/
|
||||||
public Component getComponnet(int id)
|
public Component getComponnet(int id)
|
||||||
{
|
{
|
||||||
return components.get(id);
|
synchronized(components)
|
||||||
|
{
|
||||||
|
return components.get(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -130,7 +137,10 @@ public class IceMediaStream
|
|||||||
*/
|
*/
|
||||||
public List<Component> getComponents()
|
public List<Component> getComponents()
|
||||||
{
|
{
|
||||||
return new LinkedList<Component>(components.values());
|
synchronized(components)
|
||||||
|
{
|
||||||
|
return new LinkedList<Component>(components.values());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -142,6 +152,24 @@ public class IceMediaStream
|
|||||||
*/
|
*/
|
||||||
public List<Integer> getComponentIDs()
|
public List<Integer> getComponentIDs()
|
||||||
{
|
{
|
||||||
return new LinkedList<Integer>(components.keySet());
|
synchronized(components)
|
||||||
|
{
|
||||||
|
return new LinkedList<Integer>(components.keySet());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 getStreamCount()
|
||||||
|
{
|
||||||
|
synchronized(components)
|
||||||
|
{
|
||||||
|
return components.size();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user