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

项目:java-bells    文件: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();
}
项目:java-bells    文件: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();
    }
    removePacketListener();
    removeConnectionListener();
    getConnection().removeConnectionListener(connectionListener);
    LOGGER.debug("Negotiation Closed: " + getConnection().getUser() + " " + sid);
    super.close();

}
项目:java-bells    文件: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();
}
项目:spark-svn-mirror    文件:OutgoingCall.java   
public void sessionEstablished(PayloadType payloadType, TransportCandidate transportCandidate, TransportCandidate transportCandidate1, JingleSession jingleSession) {
    established = true;
    mediaReceivedTask = new SwingTimerTask() {
        public void doRun() {
            if (!mediaReceived) {
                if (session != null) {
                    try {
                        session.terminate("No Media Received. This may be caused by firewall configuration problems.");
                    }
                    catch (XMPPException e) {
                        Log.error(e);
                    }
                }
            }
        }
    };
    TaskEngine.getInstance().schedule(mediaReceivedTask, WAIT_FOR_MEDIA_DELAY, WAIT_FOR_MEDIA_DELAY);

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            updateOutgoingCallPanel();
        }
    });
}
项目:spark-svn-mirror    文件:IncomingCall.java   
public void sessionEstablished(PayloadType payloadType, TransportCandidate transportCandidate, TransportCandidate transportCandidate1, JingleSession jingleSession) {

        established = true;
        mediaReceivedTask = new SwingTimerTask() {
            public void doRun() {
                if (!mediaReceived) {
                    if (session != null) {
                        try {
                            session.terminate("No Media Received. This may be caused by firewall configuration problems.");
                        }
                        catch (XMPPException e) {
                            Log.error(e);
                        }
                    }
                }
            }
        };
        TaskEngine.getInstance().schedule(mediaReceivedTask, WAIT_FOR_MEDIA_DELAY, WAIT_FOR_MEDIA_DELAY);
    }
项目:java-bells    文件: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;
}
项目:java-bells    文件: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;
}
项目:java-bells    文件: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;
}
项目:java-bells    文件:ContentNegotiator.java   
public void triggerContentEstablished() {

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

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

    // 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);
    }

}
项目:java-bells    文件: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;
}
项目:java-bells    文件:JingleManager.java   
public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) {
}
项目:java-bells    文件:JingleTransport.java   
/**
 * Set the transportElement candidate.
 *
 * @param cand the transportElement candidate
 */
public void setMediaTransport(final TransportCandidate cand) {
    if (cand != null) {
        transportCandidate = cand;
    }
}
项目:java-bells    文件:JingleTransport.java   
/**
 * Constructor with a transport candidate.
 */
public Candidate(final TransportCandidate tc) {
    super(tc);
}
项目:java-bells    文件:JingleTransport.java   
/**
 * Constructor with a transport candidate.
 */
public Candidate(final TransportCandidate tc) {
    super(tc);
}
项目:java-bells    文件: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);
}
项目:java-bells    文件: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();
}
项目:java-bells    文件: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();
}
项目:java-bells    文件: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);
}
项目:java-bells    文件: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();
}
项目:java-bells    文件: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();
}
项目:java-bells    文件:JingleMediaSession.java   
/**
 * Returns the Media Session local Candidate
 *
 * @return
 */
public TransportCandidate getLocal() {
    return local;
}
项目:java-bells    文件:JingleMediaSession.java   
/**
 * Returns the Media Session remote Candidate
 *
 * @return
 */
public TransportCandidate getRemote() {
    return remote;
}
项目:java-bells    文件:JingleMediaManager.java   
/**
 * Create a Media Session Implementation
 *
 * @param payloadType
 * @param remote
 * @param local
 * @return
 */
public abstract JingleMediaSession createMediaSession(PayloadType payloadType, final TransportCandidate remote,
        final TransportCandidate local, JingleSession jingleSession);
项目:java-bells    文件: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
 */
public void sessionEstablished(PayloadType pt, TransportCandidate remoteCandidate,
                               TransportCandidate localCandidate, JingleSession jingleSession);
项目:java-bells    文件: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
 */
public void transportEstablished(TransportCandidate local,
                                 TransportCandidate remote);
项目:java-bells    文件: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);
项目:java-bells    文件:JingleTransport.java   
/**
 * Creates a new TransportNegotiator child.
 *
 * @param candidate the jmf transport candidate
 */
public JingleTransportCandidate(final TransportCandidate candidate) {
    super();
    setMediaTransport(candidate);
}
项目:java-bells    文件:JingleTransport.java   
/**
 * Get the current transportElement candidate.
 *
 * @return the transportElement candidate
 */
public TransportCandidate getMediaTransport() {
    return transportCandidate;
}