-
- All Implemented Interfaces:
-
java.beans.PropertyChangeListener,java.util.EventListener
public class Component implements PropertyChangeListener
A component is a piece of a media stream requiring a single transport address; a media stream may require multiple components, each of which has to work for the media stream as a whole to work. For media streams based on RTP, there are two components per media stream - one for RTP, and one for RTCP.
-
-
Field Summary
Fields Modifier and Type Field Description public final static intRTPpublic final static intRTCPprivate final intcomponentIDprivate final IceMediaStreamparentStreamprivate final List<LocalCandidate>localCandidatesprivate final List<RemoteCandidate>remoteCandidatesprivate LocalCandidatedefaultCandidateprivate CandidatePairselectedPairprivate Candidate<out Object>defaultRemoteCandidateprivate final Loggerloggerprivate final ComponentSocketcomponentSocketprivate final MultiplexingDatagramSocketsocketprivate final IceSocketWrappersocketWrapper
-
Method Summary
Modifier and Type Method Description intgetComponentID()Returns the ID of this Component. IceMediaStreamgetParentStream()Returns a reference to the IceMediaStream that this Component belongs to. List<LocalCandidate>getLocalCandidates()Returns a copy of the list containing all local candidates currently registered in this component. List<RemoteCandidate>getRemoteCandidates()Returns a copy of the list containing all remote candidates currently registered in this component. LocalCandidategetDefaultCandidate()Returns the Candidate that has been selected as the default for this Component or null if no such Candidate has been selected yet. CandidatePairgetSelectedPair()Returns the CandidatePair selected for use by ICE processing or null if no pair has been selected so far or if ICE processing has failed. voidsetSelectedPair(CandidatePair pair)Sets the CandidatePair selected for use by ICE processing and that the application would use. Candidate<out Object>getDefaultRemoteCandidate()Returns the Candidate that the remote party has reported as default for this Component or null if no such Candidate has been reported yet. voidsetDefaultRemoteCandidate(Candidate<out Object> candidate)Sets the Candidate that the remote party has reported as default for this Component. LoggergetLogger()ComponentSocketgetComponentSocket()MultiplexingDatagramSocketgetSocket()IceSocketWrappergetSocketWrapper()booleanaddLocalCandidate(LocalCandidate candidate)Add a local candidate to this component. intcountLocalHostCandidates()Returns the number of local host candidates currently registered in this Component. intgetLocalCandidateCount()Returns the number of all local candidates currently registered in this Component. voidaddRemoteCandidate(RemoteCandidate candidate)Adds a remote Candidates to this media-stream Component. voidaddUpdateRemoteCandidates(RemoteCandidate candidate)Update the media-stream Component with the specified Candidates. voidupdateRemoteCandidates()Update ICE processing with new Candidates. voidaddRemoteCandidates(List<RemoteCandidate> candidates)Adds a List of remote Candidates as reported by a remote agent. intgetRemoteCandidateCount()Returns the number of all remote candidates currently registered in this Component. StringtoString()Returns a String representation of this Component containing its ID, parent stream name and any existing candidates. StringtoShortString()Returns a short String representation of this Component. LocalCandidatefindLocalCandidate(TransportAddress localAddress)Returns the local LocalCandidate with the specified localAddress if it belongs to this component or null if it doesn't. LocalCandidatefindLocalCandidate(TransportAddress address, LocalCandidate base)Returns the local LocalCandidate with the specified address if it belongs to this component or null if it doesn't. RemoteCandidatefindRemoteCandidate(TransportAddress remoteAddress)Returns the remote Candidate with the specified remoteAddress if it belongs to this Component or null if it doesn't. StringgetName()Returns a human readable name that can be used in debug logs associated with this component. static Componentbuild(int componentID, IceMediaStream mediaStream, Logger parentLogger)Use builder pattern to allow creation of immutable Component instances, from outside the current package. voidpropertyChange(PropertyChangeEvent event)Handles events coming from candidate pairs. -
-
Method Detail
-
getComponentID
int getComponentID()
Returns the ID of this Component. For RTP/RTCP flows this would be 1 for RTP and 2 for RTCP.
-
getParentStream
IceMediaStream getParentStream()
Returns a reference to the IceMediaStream that this Component belongs to.
-
getLocalCandidates
List<LocalCandidate> getLocalCandidates()
Returns a copy of the list containing all local candidates currently registered in this component.
-
getRemoteCandidates
List<RemoteCandidate> getRemoteCandidates()
Returns a copy of the list containing all remote candidates currently registered in this component.
-
getDefaultCandidate
LocalCandidate getDefaultCandidate()
Returns the Candidate that has been selected as the default for this Component or null if no such Candidate has been selected yet. A candidate is said to be default if it would be the target of media from a non-ICE peer;
-
getSelectedPair
CandidatePair getSelectedPair()
Returns the CandidatePair selected for use by ICE processing or null if no pair has been selected so far or if ICE processing has failed.
-
setSelectedPair
void setSelectedPair(CandidatePair pair)
Sets the CandidatePair selected for use by ICE processing and that the application would use.
- Parameters:
pair- the CandidatePair selected for use by ICE processing.
-
getDefaultRemoteCandidate
Candidate<out Object> getDefaultRemoteCandidate()
Returns the Candidate that the remote party has reported as default for this Component or null if no such Candidate has been reported yet. A candidate is said to be default if it would be the target of media from a non-ICE peer;
-
setDefaultRemoteCandidate
void setDefaultRemoteCandidate(Candidate<out Object> candidate)
Sets the Candidate that the remote party has reported as default for this Component. A candidate is said to be default if it would be the target of media from a non-ICE peer;
- Parameters:
candidate- the Candidate that the remote party has reported as default for this Component.
-
getLogger
Logger getLogger()
-
getComponentSocket
ComponentSocket getComponentSocket()
-
getSocket
MultiplexingDatagramSocket getSocket()
-
getSocketWrapper
IceSocketWrapper getSocketWrapper()
-
addLocalCandidate
boolean addLocalCandidate(LocalCandidate candidate)
Add a local candidate to this component. The method should only be accessed and local candidates added by the candidate harvesters registered with the agent.
- Parameters:
candidate- the candidate object to be added
-
countLocalHostCandidates
int countLocalHostCandidates()
Returns the number of local host candidates currently registered in this Component.
-
getLocalCandidateCount
int getLocalCandidateCount()
Returns the number of all local candidates currently registered in this Component.
-
addRemoteCandidate
void addRemoteCandidate(RemoteCandidate candidate)
Adds a remote Candidates to this media-stream Component.
- Parameters:
candidate- the Candidate instance to add.
-
addUpdateRemoteCandidates
void addUpdateRemoteCandidates(RemoteCandidate candidate)
Update the media-stream Component with the specified Candidates. This would happen when performing trickle ICE.
- Parameters:
candidate- new Candidate to add.
-
updateRemoteCandidates
void updateRemoteCandidates()
Update ICE processing with new Candidates.
-
addRemoteCandidates
void addRemoteCandidates(List<RemoteCandidate> candidates)
Adds a List of remote Candidates as reported by a remote agent.
- Parameters:
candidates- the List of Candidates reported by the remote agent for this component.
-
getRemoteCandidateCount
int getRemoteCandidateCount()
Returns the number of all remote candidates currently registered in this Component.
-
toString
String toString()
Returns a String representation of this Component containing its ID, parent stream name and any existing candidates.
-
toShortString
String toShortString()
Returns a short String representation of this Component.
-
findLocalCandidate
LocalCandidate findLocalCandidate(TransportAddress localAddress)
Returns the local LocalCandidate with the specified localAddress if it belongs to this component or null if it doesn't.
- Parameters:
localAddress- the TransportAddress we are looking for.
-
findLocalCandidate
LocalCandidate findLocalCandidate(TransportAddress address, LocalCandidate base)
Returns the local LocalCandidate with the specified address if it belongs to this component or null if it doesn't. If
baseis also specified, tries to find a candidate whose base matchesbase.- Parameters:
address- the TransportAddress we are looking for.base- an optional base to match.
-
findRemoteCandidate
RemoteCandidate findRemoteCandidate(TransportAddress remoteAddress)
Returns the remote Candidate with the specified remoteAddress if it belongs to this Component or null if it doesn't.
- Parameters:
remoteAddress- the TransportAddress we are looking for.
-
getName
String getName()
Returns a human readable name that can be used in debug logs associated with this component.
-
build
static Component build(int componentID, IceMediaStream mediaStream, Logger parentLogger)
Use builder pattern to allow creation of immutable Component instances, from outside the current package.
- Parameters:
componentID- the id of this component.mediaStream- the IceMediaStream instance that would be the parent of this component.
-
propertyChange
void propertyChange(PropertyChangeEvent event)
Handles events coming from candidate pairs.
-
-
-
-