org.jivesoftware.smackx.jingle.media
Class MediaNegotiator

java.lang.Object
  extended by org.jivesoftware.smackx.jingle.JingleNegotiator
      extended by org.jivesoftware.smackx.jingle.media.MediaNegotiator

public class MediaNegotiator
extends JingleNegotiator

Manager for jmf descriptor negotiation.

This class is responsible for managing the descriptor negotiation process, handling all the xmpp packets interchange and the stage control. handling all the xmpp packets interchange and the stage control.

Author:
Thiago Camargo

Constructor Summary
MediaNegotiator(JingleSession session, JingleMediaManager mediaManager, java.util.List<PayloadType> pts, ContentNegotiator parentNegotiator)
          Default constructor.
 
Method Summary
 void addRemoteAudioPayloadType(PayloadType.Audio pt)
          Adds a payload type to the list of remote payloads.
 void close()
          Terminate the jmf negotiator
 java.util.List<IQ> dispatchIncomingPacket(IQ iq, java.lang.String id)
          Dispatch an incoming packet.
 PayloadType getBestCommonAudioPt()
          Get the best common codec between both parts.
 JingleDescription getJingleDescription()
          Create a JingleDescription that matches this negotiator.
 JingleMediaManager getMediaManager()
          Return The media manager for this negotiator.
 boolean isEstablished()
          Return true if the content is negotiated.
 boolean isFullyEstablished()
          Return true if the content is fully negotiated.
 
Methods inherited from class org.jivesoftware.smackx.jingle.JingleNegotiator
addExpectedId, addListener, getConnection, getNegotiatorState, getSession, isExpectedId, isStarted, removeExpectedId, removeListener, setNegotiatorState, setSession, start
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MediaNegotiator

public MediaNegotiator(JingleSession session,
                       JingleMediaManager mediaManager,
                       java.util.List<PayloadType> pts,
                       ContentNegotiator parentNegotiator)
Default constructor. The constructor establishes some basic parameters, but it does not start the negotiation. For starting the negotiation, call startNegotiation.

Parameters:
js - The jingle session.
Method Detail

getMediaManager

public JingleMediaManager getMediaManager()
Return The media manager for this negotiator.


dispatchIncomingPacket

public java.util.List<IQ> dispatchIncomingPacket(IQ iq,
                                                 java.lang.String id)
                                          throws XMPPException
Dispatch an incoming packet. The method is responsible for recognizing the packet type and, depending on the current state, delivering the packet to the right event handler and wait for a response.

Specified by:
dispatchIncomingPacket in class JingleNegotiator
Parameters:
iq - the packet received
id - the ID of the response that will be sent
Returns:
the new Jingle packet to send.
Throws:
XMPPException

isEstablished

public boolean isEstablished()
Return true if the content is negotiated.

Returns:
true if the content is negotiated.

isFullyEstablished

public boolean isFullyEstablished()
Return true if the content is fully negotiated.

Returns:
true if the content is fully negotiated.

addRemoteAudioPayloadType

public void addRemoteAudioPayloadType(PayloadType.Audio pt)
Adds a payload type to the list of remote payloads.

Parameters:
pt - the remote payload type

getBestCommonAudioPt

public PayloadType getBestCommonAudioPt()
Get the best common codec between both parts.

Returns:
The best common PayloadType codec.

close

public void close()
Terminate the jmf negotiator

Overrides:
close in class JingleNegotiator

getJingleDescription

public JingleDescription getJingleDescription()
Create a JingleDescription that matches this negotiator.