Search in sources :

Example 1 with SourceDescription

use of javax.media.rtp.rtcp.SourceDescription in project Smack by igniterealtime.

the class AudioMediaSession method createSession.

/**
     * Create a Session using Speex Codec.
     *
     * @param localhost    localHost
     * @param localPort    localPort
     * @param remoteHost   remoteHost
     * @param remotePort   remotePort
     * @param eventHandler eventHandler
     * @param quality      quality
     * @param secure       secure
     * @param micOn        micOn
     * @return MediaSession
     * @throws NoProcessorException
     * @throws UnsupportedFormatException
     * @throws IOException
     * @throws GeneralSecurityException
     */
public static MediaSession createSession(String localhost, int localPort, String remoteHost, int remotePort, MediaSessionListener eventHandler, int quality, boolean secure, boolean micOn) throws NoProcessorException, UnsupportedFormatException, IOException, GeneralSecurityException {
    SpeexFormat.setFramesPerPacket(1);
    /**
         * The master key. Hardcoded for now.
         */
    byte[] masterKey = new byte[] { (byte) 0xE1, (byte) 0xF9, 0x7A, 0x0D, 0x3E, 0x01, (byte) 0x8B, (byte) 0xE0, (byte) 0xD6, 0x4F, (byte) 0xA3, 0x2C, 0x06, (byte) 0xDE, 0x41, 0x39 };
    /**
         * The master salt. Hardcoded for now.
         */
    byte[] masterSalt = new byte[] { 0x0E, (byte) 0xC6, 0x75, (byte) 0xAD, 0x49, (byte) 0x8A, (byte) 0xFE, (byte) 0xEB, (byte) 0xB6, (byte) 0x96, 0x0B, 0x3A, (byte) 0xAB, (byte) 0xE6 };
    DatagramSocket[] localPorts = MediaSession.getLocalPorts(InetAddress.getByName(localhost), localPort);
    MediaSession session = MediaSession.createInstance(remoteHost, remotePort, localPorts, quality, secure, masterKey, masterSalt);
    session.setListener(eventHandler);
    session.setSourceDescription(new SourceDescription[] { new SourceDescription(SourceDescription.SOURCE_DESC_NAME, "Superman", 1, false), new SourceDescription(SourceDescription.SOURCE_DESC_EMAIL, "cdcie.tester@je.jfcom.mil", 1, false), new SourceDescription(SourceDescription.SOURCE_DESC_LOC, InetAddress.getByName(localhost) + " Port " + session.getLocalDataPort(), 1, false), new SourceDescription(SourceDescription.SOURCE_DESC_TOOL, "JFCOM CDCIE Audio Chat", 1, false) });
    return session;
}
Also used : MediaSession(mil.jfcom.cie.media.session.MediaSession) JingleMediaSession(org.jivesoftware.smackx.jingleold.media.JingleMediaSession) DatagramSocket(java.net.DatagramSocket) SourceDescription(javax.media.rtp.rtcp.SourceDescription)

Aggregations

DatagramSocket (java.net.DatagramSocket)1 SourceDescription (javax.media.rtp.rtcp.SourceDescription)1 MediaSession (mil.jfcom.cie.media.session.MediaSession)1 JingleMediaSession (org.jivesoftware.smackx.jingleold.media.JingleMediaSession)1