Package net.java.sip.communicator.impl.protocol.jabber.extensions.jingle

Examples of net.java.sip.communicator.impl.protocol.jabber.extensions.jingle.ContentPacketExtension


                            List<MediaFormat>            formats,
                            List<RTPExtension>           rtpExtensions,
                            DynamicPayloadTypeRegistry   dynamicPayloadTypes,
                            DynamicRTPExtensionsRegistry rtpExtensionsRegistry)
    {
        ContentPacketExtension content = new ContentPacketExtension();
        RtpDescriptionPacketExtension description
                                    = new RtpDescriptionPacketExtension();

        content.setCreator(creator);
        content.setName(contentName);

        //senders - only if we have them and if they are different from default
        if(senders != null && senders != SendersEnum.both)
            content.setSenders(senders);

        //RTP description
        content.addChildExtension(description);
        description.setMedia(formats.get(0).getMediaType().toString());

        //now fill in the RTP description
        for(MediaFormat fmt : formats)
        {
View Full Code Here


     */
    public ContentPacketExtension getRemoteContent(String contentType)
    {
        for(String key : remoteContentMap.keySet())
        {
            ContentPacketExtension content = remoteContentMap.get(key);
            RtpDescriptionPacketExtension description
                = JingleUtils.getRtpDescription(content);

            if(description.getMedia().equals(contentType))
                return content;
View Full Code Here

     */
    public ContentPacketExtension getLocalContent(String contentType)
    {
        for(String key : localContentMap.keySet())
        {
            ContentPacketExtension content = localContentMap.get(key);
            RtpDescriptionPacketExtension description
                = JingleUtils.getRtpDescription(content);

            if(description.getMedia().equals(contentType))
                return content;
View Full Code Here

                closeStream(mediaType);
                continue;
            }

            // create the answer description
            ContentPacketExtension ourContent
                = JingleUtils.createDescription(
                        content.getCreator(),
                        content.getName(),
                        JingleUtils.getSenders(
                                direction,
                                !getPeer().isInitiator()),
                        mutuallySupportedFormats,
                        rtpExtensions,
                        getDynamicPayloadTypes(),
                        getRtpExtensionsRegistry());

            // ZRTP
            if(getPeer().getCall().isSipZrtpAttribute())
            {
                Map<MediaTypeSrtpControl, SrtpControl> srtpControls
                    = getSrtpControls();
                MediaTypeSrtpControl key
                    = new MediaTypeSrtpControl(mediaType, SrtpControlType.ZRTP);
                SrtpControl control = srtpControls.get(key);

                if(control == null)
                {
                    control
                        = JabberActivator.getMediaService().createZrtpControl();
                    srtpControls.put(key, control);
                }

                String helloHash[] = ((ZrtpControl)control).getHelloHashSep();

                if(helloHash != null && helloHash[1].length() > 0)
                {
                    EncryptionPacketExtension encryption = new
                        EncryptionPacketExtension();
                    ZrtpHashPacketExtension hash
                        = new ZrtpHashPacketExtension();
                    hash.setVersion(helloHash[0]);
                    hash.setValue(helloHash[1]);

                    encryption.addChildExtension(hash);
                    RtpDescriptionPacketExtension rtpDescription =
                        JingleUtils.getRtpDescription(ourContent);
                    rtpDescription.setEncryption(encryption);
                }
            }

            // got an content which have inputevt, it means that peer requests
            // a desktop sharing session so tell it we support inputevt
            if(content.getChildExtensionsOfType(InputEvtPacketExtension.class)
                    != null)
            {
                ourContent.addChildExtension(new InputEvtPacketExtension());
            }

            answer.add(ourContent);
            localContentMap.put(content.getName(), ourContent);
View Full Code Here

        boolean masterStreamSet = false;
        for(Map.Entry<ContentPacketExtension, RtpDescriptionPacketExtension> en
                : contents.entrySet())
        {
            ContentPacketExtension ourContent = en.getKey();

            RtpDescriptionPacketExtension description = en.getValue();
            MediaType type = MediaType.parseString(description.getMedia());

            // stream connector
            StreamConnector connector
                = transportManager.getStreamConnector(type);

            //the device this stream would be reading from and writing to.
            MediaDevice dev = getDefaultDevice(type);

            // stream target
            MediaStreamTarget target = transportManager.getStreamTarget(type);

            //stream direction
            MediaDirection direction
                = JingleUtils.getDirection(ourContent, !peer.isInitiator());

            // if we answer with video, tell remote peer that video direction is
            // sendrecv, and whether video device can capture(send)
            if(type == MediaType.VIDEO && isLocalVideoTransmissionEnabled()
                && dev.getDirection().allowsSending())
            {
               direction = MediaDirection.SENDRECV;
               ourContent.setSenders(SendersEnum.both);
            }

            //let's now see what was the format we announced as first and
            //configure the stream with it.
            ContentPacketExtension theirContent
                = this.remoteContentMap.get(ourContent.getName());
            RtpDescriptionPacketExtension theirDescription
                = JingleUtils.getRtpDescription(theirContent);
            MediaFormat format = null;
View Full Code Here

            // can send
            receiveQualityPreset = qualityControls.getRemoteSendMaxPreset();
        }
        if(direction != MediaDirection.INACTIVE)
        {
            ContentPacketExtension content = createContentForOffer(
                    dev.getSupportedFormats(sendQualityPreset,
                        receiveQualityPreset), direction,
                    dev.getSupportedExtensions());

            //ZRTP
View Full Code Here

        List<ContentPacketExtension> mediaDescs
                                    = new ArrayList<ContentPacketExtension>();

        if (dev != null)
        {
            ContentPacketExtension content = createContent(dev);

            if(content != null)
                mediaDescs.add(content);
        }
View Full Code Here

                if (MediaDirection.RECVONLY.equals(direction))
                    direction = MediaDirection.INACTIVE;

                if(direction != MediaDirection.INACTIVE)
                {
                    ContentPacketExtension content
                        = createContentForOffer(
                                dev.getSupportedFormats(),
                                direction,
                                dev.getSupportedExtensions());

                    //ZRTP
                    if(getPeer().getCall().isSipZrtpAttribute())
                    {
                        Map<MediaTypeSrtpControl, SrtpControl> srtpControls
                            = getSrtpControls();
                        MediaTypeSrtpControl key
                            = new MediaTypeSrtpControl(
                                    mediaType,
                                    SrtpControlType.ZRTP);
                        SrtpControl control = srtpControls.get(key);

                        if(control == null)
                        {
                            control
                                = JabberActivator.getMediaService()
                                        .createZrtpControl();
                            srtpControls.put(key, control);
                        }

                        String helloHash[] =
                            ((ZrtpControl) control).getHelloHashSep();

                        if(helloHash != null && helloHash[1].length() > 0)
                        {
                            EncryptionPacketExtension encryption = new
                                EncryptionPacketExtension();
                            ZrtpHashPacketExtension hash
                                = new ZrtpHashPacketExtension();
                            hash.setVersion(helloHash[0]);
                            hash.setValue(helloHash[1]);

                            encryption.addChildExtension(hash);
                            RtpDescriptionPacketExtension description =
                                JingleUtils.getRtpDescription(content);
                            description.setEncryption(encryption);
                        }
                    }

                    /* we request a desktop sharing session so add the inputevt
                     * extension in the "video" content
                     */
                    RtpDescriptionPacketExtension description
                        = JingleUtils.getRtpDescription(content);
                    if(description.getMedia().equals(MediaType.VIDEO.toString())
                            && localInputEvtAware)
                    {
                        content.addChildExtension(
                                new InputEvtPacketExtension());
                    }

                    mediaDescs.add(content);
                }
View Full Code Here

    private ContentPacketExtension createContentForOffer(
                                        List<MediaFormat>  supportedFormats,
                                        MediaDirection     direction,
                                        List<RTPExtension> supportedExtensions)
    {
        ContentPacketExtension content
            = JingleUtils.createDescription(
                    CreatorEnum.initiator,
                    supportedFormats.get(0).getMediaType().toString(),
                    JingleUtils.getSenders(direction, !getPeer().isInitiator()),
                    supportedFormats,
                    supportedExtensions,
                    getDynamicPayloadTypes(),
                    getRtpExtensionsRegistry());

        this.localContentMap.put(content.getName(), content);
        return content;
    }
View Full Code Here

            IllegalArgumentException
    {
        boolean masterStreamSet = false;
        for(String key : remoteContentMap.keySet())
        {
            ContentPacketExtension ext = remoteContentMap.get(key);

            boolean masterStream = false;
            // if we have more than one stream, lets the audio be the master
            if(!masterStreamSet)
            {
View Full Code Here

TOP

Related Classes of net.java.sip.communicator.impl.protocol.jabber.extensions.jingle.ContentPacketExtension

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.