Class MediaNegotiator
- java.lang.Object
-
- org.jivesoftware.smackx.jingleold.JingleNegotiator
-
- org.jivesoftware.smackx.jingleold.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.
-
-
Field Summary
-
Fields inherited from class org.jivesoftware.smackx.jingleold.JingleNegotiator
session
-
-
Constructor Summary
Constructors Constructor Description MediaNegotiator(JingleSession session, JingleMediaManager mediaManager, java.util.List<PayloadType> pts, ContentNegotiator parentNegotiator)
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.protected void
doStart()
Called from above when starting a new session.PayloadType
getBestCommonAudioPt()
Get the best common codec between both parts.JingleDescription
getJingleDescription()
Create a JingleDescription that matches this negotiator.JingleMediaManager
getMediaManager()
Returns 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.protected void
triggerMediaClosed(PayloadType currPt)
Trigger a jmf closed event.protected void
triggerMediaEstablished(PayloadType bestPt)
Trigger a session established event.-
Methods inherited from class org.jivesoftware.smackx.jingleold.JingleNegotiator
addExpectedId, addListener, getConnection, getListenersList, getNegotiatorState, getSession, isExpectedId, isStarted, removeExpectedId, removeListener, setNegotiatorState, setSession, start
-
-
-
-
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:
session
- TODO javadoc me pleasemediaManager
- the media manager.pts
- the list of payload types.parentNegotiator
- the parent content negotiator.
-
-
Method Detail
-
getMediaManager
public JingleMediaManager getMediaManager()
Returns the media manager for this negotiator.- Returns:
- the media manager.
-
dispatchIncomingPacket
public java.util.List<IQ> dispatchIncomingPacket(IQ iq, java.lang.String id) throws XMPPException, SmackException.NotConnectedException, java.lang.InterruptedException
Dispatch an incoming packet. The method is responsible for recognizing the stanza type and, depending on the current state, delivering the stanza to the right event handler and wait for a response.- Specified by:
dispatchIncomingPacket
in classJingleNegotiator
- Parameters:
iq
- TODO javadoc me please the stanza receivedid
- the ID of the response that will be sent- Returns:
- the new Jingle stanza to send.
- Throws:
XMPPException
- if an XMPP protocol error was received.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.
-
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
- TODO javadoc me please the remote payload type
-
getBestCommonAudioPt
public PayloadType getBestCommonAudioPt()
Get the best common codec between both parts.- Returns:
- The best common PayloadType codec.
-
triggerMediaEstablished
protected void triggerMediaEstablished(PayloadType bestPt) throws SmackException.NotConnectedException, java.lang.InterruptedException
Trigger a session established event.- Parameters:
bestPt
- TODO javadoc me please payload type that has been agreed.- Throws:
SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.
-
triggerMediaClosed
protected void triggerMediaClosed(PayloadType currPt)
Trigger a jmf closed event.- Parameters:
currPt
- TODO javadoc me please current payload type that is cancelled.
-
doStart
protected void doStart()
Called from above when starting a new session.- Specified by:
doStart
in classJingleNegotiator
-
close
public void close()
Terminate the jmf negotiator.- Overrides:
close
in classJingleNegotiator
-
getJingleDescription
public JingleDescription getJingleDescription()
Create a JingleDescription that matches this negotiator.- Returns:
- the jingle description.
-
-