org.lastbamboo.common.ice
Interface IceMediaStream

All Superinterfaces:
EventListener, org.littleshoot.mina.common.IoServiceListener
All Known Implementing Classes:
IceMediaStreamImpl

public interface IceMediaStream
extends org.littleshoot.mina.common.IoServiceListener

A media stream for an ICE agent.


Method Summary
 void addLocalCandidate(IceCandidate localCandidate)
          Adds a local candidate.
 void addPair(IceCandidatePair pair)
          Adds the specified ICE candidate pair to the check list.
 IceCandidate addRemotePeerReflexive(org.littleshoot.stun.stack.message.BindingRequest request, InetSocketAddress localAddress, InetSocketAddress remoteAddress, boolean isUdp)
          Adds a peer reflexive candidate to the list of remote candidates.
 void addTriggeredPair(IceCandidatePair pair)
          Adds a pair to the triggered check queue.
 void addValidPair(IceCandidatePair pair)
          Adds a new valid pair.
 void close()
          Perform any necessary close operations for the media stream.
 byte[] encodeCandidates()
          Encodes this media stream in SDP.
 void establishStream(Collection<IceCandidate> remoteCandidates)
          Establishes a media stream using the answer data from the remote host.
 IceCheckListState getCheckListState()
          Gets the state of the check list.
 IceCandidate getLocalCandidate(InetSocketAddress localAddress, boolean isUdp)
          Accessor for the local candidate associate with the specified local address.
 Collection<IceCandidate> getLocalCandidates()
          Accessor for the local candidates for this stream.
 Queue<IceCandidatePair> getNominatedPairs()
          Accessor for all nominated pairs for this stream.
 IceCandidatePair getPair(InetSocketAddress localAddress, InetSocketAddress remoteAddress, boolean udp)
          Accesses the pair matching the specified local and remote addresses, if any.
 InetAddress getPublicAddress()
           
 IceCandidate getRemoteCandidate(InetSocketAddress remoteAddress, boolean isUdp)
          Accessor for the remote candidate associate with the specified remote address.
 IceStunUdpPeer getStunUdpPeer()
           
 Queue<IceCandidatePair> getValidPairs()
          Accessor for all valid pairs for this stream.
 boolean hasHigherPriorityPendingPair(IceCandidatePair pair)
          Checks whether or not there are existing pairs on either the triggered check list or the normal check list.
 boolean hasRemoteCandidate(InetSocketAddress remoteAddress, boolean isUdp)
          Checks whether or not the specified remote address matches any of the addresses of remote candidates.
 boolean hasRemoteCandidateInSdp(InetSocketAddress remoteAddress, boolean isUdp)
          Checks whether or not the specified remote address matches any of the addresses of remote candidates.
 void onNominated(IceCandidatePair pair)
          Notifies the media stream that there's been a nominated pair.
 void recomputePairPriorities(boolean controlling)
          Recomputes the priorities of pairs in checklists.
 void setCheckListState(IceCheckListState state)
          Sets the state of the check list.
 void start(IceCheckList checkList, Collection<IceCandidate> localCandidates, IceCheckScheduler scheduler)
          Starts gathering candidates and executing ICE.
 void updateCheckListAndTimerStates()
          Implements ICE section 7.1.2.3.
 void updatePairStates(IceCandidatePair generatingPair)
          Called when connectivity checks have created a new valid pair and the media stream needs to update the states of other pairs.
 
Methods inherited from interface org.littleshoot.mina.common.IoServiceListener
serviceActivated, serviceDeactivated, sessionCreated, sessionDestroyed
 

Method Detail

getValidPairs

Queue<IceCandidatePair> getValidPairs()
Accessor for all valid pairs for this stream.

Returns:
The Queue of all valid pairs for this stream.

addValidPair

void addValidPair(IceCandidatePair pair)
Adds a new valid pair.

Parameters:
pair - The pair to add.

getRemoteCandidate

IceCandidate getRemoteCandidate(InetSocketAddress remoteAddress,
                                boolean isUdp)
Accessor for the remote candidate associate with the specified remote address.

Parameters:
remoteAddress - The remote address to look for.
isUdp - Whether to search for UDP candidates.
Returns:
The candidate associated with the specified remote address, or null if there's no associated candidate.

getLocalCandidate

IceCandidate getLocalCandidate(InetSocketAddress localAddress,
                               boolean isUdp)
Accessor for the local candidate associate with the specified local address.

Parameters:
localAddress - The local address to look for.
Returns:
The candidate associated with the specified local address, or null if there's no associated candidate.

addLocalCandidate

void addLocalCandidate(IceCandidate localCandidate)
Adds a local candidate.

Parameters:
localCandidate - The local candidate to add.

getPair

IceCandidatePair getPair(InetSocketAddress localAddress,
                         InetSocketAddress remoteAddress,
                         boolean udp)
Accesses the pair matching the specified local and remote addresses, if any.

Parameters:
localAddress - The address for the local candidate.
remoteAddress - The address for the remote candidate.
udp - Whether or not the pair is UDP.
Returns:
The pair matching both addresses, or null if no such pair exists.

updatePairStates

void updatePairStates(IceCandidatePair generatingPair)
Called when connectivity checks have created a new valid pair and the media stream needs to update the states of other pairs.

Parameters:
generatingPair - The pair that generated the valid pair.

addTriggeredPair

void addTriggeredPair(IceCandidatePair pair)
Adds a pair to the triggered check queue.

Parameters:
pair - The pair to add.

recomputePairPriorities

void recomputePairPriorities(boolean controlling)
Recomputes the priorities of pairs in checklists. This can happen, for example, if our role has changed from controlling to controlled or vice versa.

Parameters:
controlling - The current controlling status of the agent.

establishStream

void establishStream(Collection<IceCandidate> remoteCandidates)
Establishes a media stream using the answer data from the remote host.

Parameters:
remoteCandidates - The answer from the remote host.

hasRemoteCandidate

boolean hasRemoteCandidate(InetSocketAddress remoteAddress,
                           boolean isUdp)
Checks whether or not the specified remote address matches any of the addresses of remote candidates. This is typically used when checking for peer reflexive candidates. If it's an address we don't know about, it's typically a new peer reflexive candidate.

Parameters:
remoteAddress - The remote address to check.
isUdp - Whether or not the candidate is UDP.
Returns:
true if the address matches the address of a remote candidate we already know about, otherwise false.

hasRemoteCandidateInSdp

boolean hasRemoteCandidateInSdp(InetSocketAddress remoteAddress,
                                boolean isUdp)
Checks whether or not the specified remote address matches any of the addresses of remote candidates. This is typically used when checking for peer reflexive candidates. If it's an address we don't know about, it's typically a new peer reflexive candidate.

Parameters:
remoteAddress - The remote address to check.
isUdp - Whether or not the candidate is UDP.
Returns:
true if the address matches the address of a remote candidate we already know about, otherwise false.

addRemotePeerReflexive

IceCandidate addRemotePeerReflexive(org.littleshoot.stun.stack.message.BindingRequest request,
                                    InetSocketAddress localAddress,
                                    InetSocketAddress remoteAddress,
                                    boolean isUdp)
Adds a peer reflexive candidate to the list of remote candidates.

Parameters:
request - The BindingRequest that initiated the establishment of a new peer reflexive candidate.
localAddress - The local address the request was sent to. This allows us to match the local address with the local candidate it was sent to. We use that to determine the component ID of the new peer reflexive candidate.
remoteAddress - The remote address of the peer that sent the Binding Request.
isUdp - Whether the candidate should be a UDP candidate or not.
Returns:
The new peer reflexive remote candidate.

encodeCandidates

byte[] encodeCandidates()
Encodes this media stream in SDP.

Returns:
The media stream encoded in SDP.

addPair

void addPair(IceCandidatePair pair)
Adds the specified ICE candidate pair to the check list.

Parameters:
pair - The pair to add.

getCheckListState

IceCheckListState getCheckListState()
Gets the state of the check list.

Returns:
The state of the check list.

updateCheckListAndTimerStates

void updateCheckListAndTimerStates()
Implements ICE section 7.1.2.3. Check List and Timer State Updates.


hasHigherPriorityPendingPair

boolean hasHigherPriorityPendingPair(IceCandidatePair pair)
Checks whether or not there are existing pairs on either the triggered check list or the normal check list. For the normal check list, the pair must be in the FROZEN, WAITING, or IN PROGRESS states.

Parameters:
pair - The pair to check.
Returns:
true if there's a higher priority pair that could still complete its check, otherwise false.

onNominated

void onNominated(IceCandidatePair pair)
Notifies the media stream that there's been a nominated pair. The media stream follows the process in section 8.1.2, removing all Waiting and Frozen pairs in the check list and the triggered check queue and ceasing retransmissions for pairs that are In-Progress if their priorities are lower than the nominated pair.

Parameters:
pair - The nominated pair.

setCheckListState

void setCheckListState(IceCheckListState state)
Sets the state of the check list.

Parameters:
state - The state of the check list.

getNominatedPairs

Queue<IceCandidatePair> getNominatedPairs()
Accessor for all nominated pairs for this stream.

Returns:
The Queue of all nominated pairs for this stream.

start

void start(IceCheckList checkList,
           Collection<IceCandidate> localCandidates,
           IceCheckScheduler scheduler)
Starts gathering candidates and executing ICE.

Parameters:
checkList - The candidate pair check list.
localCandidates - The local candidates.
scheduler - The check scheduler.

close

void close()
Perform any necessary close operations for the media stream.


getLocalCandidates

Collection<IceCandidate> getLocalCandidates()
Accessor for the local candidates for this stream.

Returns:
The local candidates for this stream.

getPublicAddress

InetAddress getPublicAddress()

getStunUdpPeer

IceStunUdpPeer getStunUdpPeer()


Copyright © 2013 LittleShoot. All Rights Reserved.