Fix a bug in Agent.getSelectedPair(), update documentation.

This commit is contained in:
boris 2015-01-22 16:11:54 +00:00
parent 7d58fe7a29
commit 0c30dc7ae6

View File

@ -2199,32 +2199,23 @@ public class Agent
} }
/** /**
* Returns the selected pair for this Agent. * Returns the selected pair for the RTP component for the ICE media stream
* with name <tt>streamName</tt> of this Agent, or <tt>null</tt>.
* *
* @param streamName The stream name (AUDIO, VIDEO); * @param streamName The stream name.
* *
* @return The selected pair for this Agent. Null if no pair is selected. * @return the selected pair for the RTP component for the ICE media stream
* with name <tt>streamName</tt> of this Agent, or <tt>null</tt>.
*/ */
private CandidatePair getSelectedPair(String streamName) private CandidatePair getSelectedPair(String streamName)
{ {
List<IceMediaStream> iceMediaStreams = this.getStreams(); IceMediaStream stream = getStream(streamName);
for(int i = 0; i < iceMediaStreams.size(); ++i) if (stream != null)
{
if(iceMediaStreams.get(i).getName().equals(streamName))
{
List<org.ice4j.ice.Component> components =
iceMediaStreams.get(i).getComponents();
for(int j = 0; j < components.size(); ++j)
{
Component component = components.get(i);
if(component.getComponentID()
== org.ice4j.ice.Component.RTP)
{ {
Component component = stream.getComponent(Component.RTP);
if (component != null)
return component.getSelectedPair(); return component.getSelectedPair();
} }
}
}
}
return null; return null;
} }