Java 类org.jivesoftware.smackx.jingleold.nat.TransportCandidate 实例源码

项目:Smack    文件:JingleSession.java   
/**
 * Trigger a session closed event due to an error.
 */
protected void triggerSessionClosedOnError(XMPPException exc) {
    for (ContentNegotiator contentNegotiator : contentNegotiators) {

        contentNegotiator.stopJingleMediaSession();

        for (TransportCandidate candidate : contentNegotiator.getTransportNegotiator().getOfferedCandidates())
            candidate.removeCandidateEcho();
    }
    List<JingleListener> listeners = getListenersList();
    for (JingleListener li : listeners) {
        if (li instanceof JingleSessionListener) {
            JingleSessionListener sli = (JingleSessionListener) li;
            sli.sessionClosedOnError(exc, this);
        }
    }
    close();
}
项目:Smack    文件:JingleSession.java   
/**
 * Terminate negotiations.
 */
public void close() {
    if (isClosed())
        return;

    // Set the session state to ENDED.
    setSessionState(JingleSessionStateEnded.getInstance());

    for (ContentNegotiator contentNegotiator : contentNegotiators) {

        contentNegotiator.stopJingleMediaSession();

        for (TransportCandidate candidate : contentNegotiator.getTransportNegotiator().getOfferedCandidates())
            candidate.removeCandidateEcho();

        contentNegotiator.close();
    }
    removeAsyncPacketListener();
    removeConnectionListener();
    getConnection().removeConnectionListener(connectionListener);
    LOGGER.fine("Negotiation Closed: " + getConnection().getUser() + " " + sid);
    super.close();

}
项目:Smack    文件:JingleTransport.java   
/**
 * Get the elements of this candidate.
 */
protected String getChildElements() {
    StringBuilder buf = new StringBuilder();

    if (transportCandidate != null && transportCandidate instanceof TransportCandidate.Fixed) {
        TransportCandidate.Fixed tcf = (TransportCandidate.Fixed) transportCandidate;

        buf.append(" generation=\"").append(tcf.getGeneration()).append("\"");
        buf.append(" ip=\"").append(tcf.getIp()).append("\"");
        buf.append(" port=\"").append(tcf.getPort()).append("\"");

        // Optional parameters
        String name = tcf.getName();
        if (name != null) {
            buf.append(" name=\"").append(name).append("\"");
        }
    }
    return buf.toString();
}
项目:Smack    文件:ScreenShareMediaManager.java   
/**
 * Returns a new JingleMediaSession
 *
 * @param payloadType payloadType
 * @param remote      remote Candidate
 * @param local       local Candidate
 * @return JingleMediaSession JingleMediaSession
 */
public JingleMediaSession createMediaSession(PayloadType payloadType, final TransportCandidate remote, final TransportCandidate local, final JingleSession jingleSession) {
    ScreenShareSession session = null;
    session = new ScreenShareSession(payloadType, remote, local, "Screen", jingleSession);
    if (encoder != null) {
        session.setEncoder(encoder);
    }
    if (decoder != null) {
        session.setDecoder(decoder);
    }
    return session;
}
项目:Smack    文件:TestMediaManager.java   
/**
 * Returns a new JingleMediaSession
 *
 * @param payloadType payloadType
 * @param remote      remote Candidate
 * @param local       local Candidate
 * @return JingleMediaSession JingleMediaSession
 */
public JingleMediaSession createMediaSession(PayloadType payloadType, final TransportCandidate remote,
        final TransportCandidate local, final JingleSession jingleSession) {
    TestMediaSession session = null;

    session = new TestMediaSession(payloadType, remote, local, "", jingleSession);

    return session;
}
项目:Smack    文件:MultiMediaManager.java   
/**
 * Returns a new JingleMediaSession
 *
 * @param payloadType payloadType
 * @param remote      remote Candidate
 * @param local       local Candidate
 * @return JingleMediaSession JingleMediaSession
 */
public JingleMediaSession createMediaSession(PayloadType payloadType, final TransportCandidate remote, final TransportCandidate local, final JingleSession jingleSession) {
    for (JingleMediaManager manager : managers) {
        if (manager.getPayloads().contains(payloadType)) {
            return manager.createMediaSession(payloadType, remote, local, jingleSession);
        }
    }
    return null;
}
项目:Smack    文件:ContentNegotiator.java   
public void triggerContentEstablished() throws NotConnectedException {

        PayloadType bestCommonAudioPt = getMediaNegotiator().getBestCommonAudioPt();
        TransportCandidate bestRemoteCandidate = getTransportNegotiator().getBestRemoteCandidate();
        TransportCandidate acceptedLocalCandidate = getTransportNegotiator().getAcceptedLocalCandidate();

        // Trigger the session established flag
        triggerContentEstablished(bestCommonAudioPt, bestRemoteCandidate, acceptedLocalCandidate);
    }
项目:Smack    文件:ContentNegotiator.java   
/**
 * Trigger a session established event.
 * @throws NotConnectedException 
 */
private void triggerContentEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc) throws NotConnectedException {

    // Let the session know that we've established a content/media segment.
    JingleSession session = getSession();
    if (session != null) {
        List<JingleListener> listeners = session.getListenersList();
        for (JingleListener li : listeners) {
            if (li instanceof JingleSessionListener) {
                JingleSessionListener sli = (JingleSessionListener) li;
                sli.sessionEstablished(pt, rc, lc, session);
            }
        }
    }

    // Create a media session for each media manager in the session.
    if (mediaNeg.getMediaManager() != null) {
        rc.removeCandidateEcho();
        lc.removeCandidateEcho();

        jingleMediaSession = getMediaNegotiator().getMediaManager().createMediaSession(pt, rc, lc, session);
        jingleMediaSession.addMediaReceivedListener(session);
        if (jingleMediaSession != null) {

            jingleMediaSession.startTrasmit();
            jingleMediaSession.startReceive();

            for (TransportCandidate candidate : getTransportNegotiator().getOfferedCandidates())
                candidate.removeCandidateEcho();
        }
        JingleMediaManager mediaManager = getMediaNegotiator().getMediaManager();
        getSession().addJingleMediaSession(mediaManager.getName(), jingleMediaSession);
    }

}
项目:Smack    文件:JingleMediaSession.java   
/**
 * Creates a new JingleMediaSession Instance to handle Media methods.
 *
 * @param payloadType  Payload Type of the transmittion
 * @param remote       Remote accepted Transport Candidate
 * @param local        Local accepted Transport Candidate
 * @param mediaLocator Media Locator of the capture device
 */
public JingleMediaSession(PayloadType payloadType, TransportCandidate remote,
        TransportCandidate local, String mediaLocator, JingleSession jingleSession) {
    this.local = local;
    this.remote = remote;
    this.payloadType = payloadType;
    this.mediaLocator = mediaLocator;
    this.jingleSession = jingleSession;
}
项目:Smack    文件:JingleManager.java   
public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) {
}
项目:Smack    文件:JingleTransport.java   
/**
 * Set the transportElement candidate.
 *
 * @param cand the transportElement candidate
 */
public void setMediaTransport(final TransportCandidate cand) {
    if (cand != null) {
        transportCandidate = cand;
    }
}
项目:Smack    文件:JingleTransport.java   
/**
 * Constructor with a transport candidate.
 */
public Candidate(final TransportCandidate tc) {
    super(tc);
}
项目:Smack    文件:JingleTransport.java   
/**
 * Constructor with a transport candidate.
 */
public Candidate(final TransportCandidate tc) {
    super(tc);
}
项目:Smack    文件:JmfMediaManager.java   
/**
 * Returns a new jingleMediaSession
 *
 * @param payloadType payloadType
 * @param remote      remote Candidate
 * @param local       local Candidate
 * @return JingleMediaSession
 */
public JingleMediaSession createMediaSession(final PayloadType payloadType, final TransportCandidate remote, final TransportCandidate local, final JingleSession jingleSession) {
    return new AudioMediaSession(payloadType, remote, local, mediaLocator, jingleSession);
}
项目:Smack    文件:AudioMediaSession.java   
/**
 * Creates a org.jivesoftware.jingleaudio.jmf.AudioMediaSession with defined payload type, remote and local candidates
 *
 * @param payloadType Payload of the jmf
 * @param remote      the remote information. The candidate that the jmf will be sent to.
 * @param local       the local information. The candidate that will receive the jmf
 * @param locator     media locator
 */
public AudioMediaSession(final PayloadType payloadType, final TransportCandidate remote,
        final TransportCandidate local, String locator, JingleSession jingleSession) {
    super(payloadType, remote, local, locator==null?"dsound://":locator,jingleSession);
    initialize();
}
项目:Smack    文件:ScreenShareSession.java   
/**
 * Creates a org.jivesoftware.jingleaudio.jmf.AudioMediaSession with defined payload type, remote and local candidates
 *
 * @param payloadType Payload of the jmf
 * @param remote      the remote information. The candidate that the jmf will be sent to.
 * @param local       the local information. The candidate that will receive the jmf
 * @param locator     media locator
 */
public ScreenShareSession(final PayloadType payloadType, final TransportCandidate remote, final TransportCandidate local,
        final String locator, JingleSession jingleSession) {
    super(payloadType, remote, local, "Screen", jingleSession);
    initialize();
}
项目:Smack    文件:SpeexMediaManager.java   
/**
 * Returns a new jingleMediaSession
 *
 * @param payloadType payloadType
 * @param remote      remote Candidate
 * @param local       local Candidate
 * @return JingleMediaSession
 */
public JingleMediaSession createMediaSession(PayloadType payloadType, final TransportCandidate remote, final TransportCandidate local, final JingleSession jingleSession) {
    return new AudioMediaSession(payloadType, remote, local, null,null);
}
项目:Smack    文件:AudioMediaSession.java   
/**
 * Creates a org.jivesoftware.jingleaudio.jspeex.AudioMediaSession with defined payload type, remote and local candidates
 *
 * @param payloadType Payload of the jmf
 * @param remote      the remote information. The candidate that the jmf will be sent to.
 * @param local       the local information. The candidate that will receive the jmf
 * @param locator     media locator
 */
public AudioMediaSession(final PayloadType payloadType, final TransportCandidate remote,
        final TransportCandidate local, String locator, JingleSession jingleSession) {
    super(payloadType, remote, local, locator == null ? "dsound://" : locator, jingleSession);
    initialize();
}
项目:Smack    文件:TestMediaSession.java   
/**
 * Creates a TestMediaSession with defined payload type, remote and local candidates
 *
 * @param payloadType Payload of the jmf
 * @param remote      the remote information. The candidate that the jmf will be sent to.
 * @param local       the local information. The candidate that will receive the jmf
 * @param locator     media locator
 */
public TestMediaSession(final PayloadType payloadType, final TransportCandidate remote, final TransportCandidate local,
        final String locator, JingleSession jingleSession) {
    super(payloadType, remote, local, "Test", jingleSession);
    initialize();
}
项目:Smack    文件:JingleMediaSession.java   
/**
 * Returns the Media Session local Candidate
 *
 * @return the TransportCandidate
 */
public TransportCandidate getLocal() {
    return local;
}
项目:Smack    文件:JingleMediaSession.java   
/**
 * Returns the Media Session remote Candidate
 *
 * @return the TransportCandidate
 */
public TransportCandidate getRemote() {
    return remote;
}
项目:Smack    文件:JingleMediaManager.java   
/**
 * Create a Media Session Implementation
 *
 * @param payloadType
 * @param remote
 * @param local
 * @return the media session
 */
public abstract JingleMediaSession createMediaSession(PayloadType payloadType, final TransportCandidate remote,
        final TransportCandidate local, JingleSession jingleSession);
项目:Smack    文件:JingleTransport.java   
/**
 * Creates a new TransportNegotiator child.
 *
 * @param candidate the jmf transport candidate
 */
public JingleTransportCandidate(final TransportCandidate candidate) {
    super();
    setMediaTransport(candidate);
}
项目:Smack    文件:JingleTransport.java   
/**
 * Get the current transportElement candidate.
 *
 * @return the transportElement candidate
 */
public TransportCandidate getMediaTransport() {
    return transportCandidate;
}
项目:Smack    文件:JingleSessionListener.java   
/**
 * Notification that the session has been established. Arguments specify
 * the payload type and transport to use.
 *
 * @param pt            the Payload tyep to use
 * @param remoteCandidate            the remote candidate to use for connecting to the remote
 *                      service.
 * @param localCandidate            the local candidate where we must listen for connections
 * @param jingleSession Session that called the method
 * @throws NotConnectedException 
 */
public void sessionEstablished(PayloadType pt, TransportCandidate remoteCandidate,
                               TransportCandidate localCandidate, JingleSession jingleSession) throws NotConnectedException;
项目:Smack    文件:JingleTransportListener.java   
/**
 * Notification that the transport has been established.
 *
 * @param local  The transport candidate that has been used for listening
 *               in the local machine
 * @param remote The transport candidate that has been used for
 *               transmitting to the remote machine
 * @throws NotConnectedException 
 */
public void transportEstablished(TransportCandidate local,
                                 TransportCandidate remote) throws NotConnectedException;
项目:Smack    文件:JingleTransportListener.java   
/**
 * Notification that a transport must be cancelled.
 *
 * @param cand The transport candidate that must be cancelled. A value
 *             of "null" means all the transports for this session.
 */
public void transportClosed(TransportCandidate cand);