Class 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.
    • 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 please
        mediaManager - 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<org.jivesoftware.smack.packet.IQ> dispatchIncomingPacket​(org.jivesoftware.smack.packet.IQ iq,
                                                                                       java.lang.String id)
                                                                                throws org.jivesoftware.smack.XMPPException,
                                                                                       org.jivesoftware.smack.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 class JingleNegotiator
        Parameters:
        iq - TODO javadoc me please the stanza received
        id - the ID of the response that will be sent
        Returns:
        the new Jingle stanza to send.
        Throws:
        org.jivesoftware.smack.XMPPException - if an XMPP protocol error was received.
        org.jivesoftware.smack.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 org.jivesoftware.smack.SmackException.NotConnectedException,
                                               java.lang.InterruptedException
        Trigger a session established event.
        Parameters:
        bestPt - TODO javadoc me please payload type that has been agreed.
        Throws:
        org.jivesoftware.smack.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 class JingleNegotiator
      • getJingleDescription

        public JingleDescription getJingleDescription()
        Create a JingleDescription that matches this negotiator.
        Returns:
        the jingle description.