Package javax.media.rtp

Examples of javax.media.rtp.SendStream


    PushBufferStream pbss[] = pbds.getStreams();

    rtpMgrs = new RTPManager[pbss.length];
    SessionAddress localAddr, destAddr;
    InetAddress ipAddr;
    SendStream sendStream;
    int port;
    SourceDescription srcDesList[];

    for (int i = 0; i < pbss.length; i++) {
        try {
      rtpMgrs[i] = RTPManager.newInstance();     
     
      port = portBase + 2*i;
      ipAddr = InetAddress.getByName(ipAddress);
     
     
      System.out.println("createTransmitter  localAddress: " + InetAddress.getLocalHost() + "=" + sourcePort);

      localAddr = new SessionAddress( InetAddress.getLocalHost(),sourcePort);
     
      System.out.println("createTransmitter  destAddress: " + ipAddress + "=" + port);

      destAddr = new SessionAddress( ipAddr, port);

      rtpMgrs[i].initialize( localAddr);
     
      rtpMgrs[i].addTarget( destAddr);
     
      sendStream = rtpMgrs[i].createSendStream(dataOutput, i);
     
      sendStream.start();
        } catch (Exception  e) {
          return e.getMessage();
        }
    }

View Full Code Here


        PushBufferStream pbss[] = pbds.getStreams();

        rtpMgrs = new RTPManager[pbss.length];
        SessionAddress localAddr, destAddr;
        InetAddress ipAddr;
        SendStream sendStream;
        audioReceiver = new AudioReceiver(this, jingleMediaSession);
        int port;

        for (int i = 0; i < pbss.length; i++) {
            try {
                rtpMgrs[i] = RTPManager.newInstance();

                port = portBase + 2 * i;
                ipAddr = InetAddress.getByName(remoteIpAddress);

                System.out.println(localIpAddress);
               
                InetAddress adress = InetAddress.getByName(this.localIpAddress);
               
//              First get hostname as otherwise on linux it only gives back the ip instead of hostname/ip
                //which will cause the check on local address to fail in JMF
                InetAddress host = InetAddress.getLocalHost();
                String hostname = host.getHostName();
                InetAddress[] addrlist = InetAddress.getAllByName(hostname);
                for(InetAddress iaddress : addrlist){
                  if(iaddress.getHostAddress().equals(localIpAddress)) {
                    adress = iaddress;
                    break;
                  }
                }
                               
                localAddr = new SessionAddress(adress, localPort);

//                localAddr = new SessionAddress(InetAddress.getByName(this.localIpAddress),
//                        localPort);

               
                destAddr = new SessionAddress(ipAddr, port);

                rtpMgrs[i].addReceiveStreamListener(audioReceiver);
                rtpMgrs[i].addSessionListener(audioReceiver);

                BufferControl bc = (BufferControl) rtpMgrs[i].getControl("javax.media.control.BufferControl");
                if (bc != null) {
                    int bl = 160;
                    bc.setBufferLength(bl);
                }

                try {

                rtpMgrs[i].initialize(localAddr);

                }
                catch (InvalidSessionAddressException e) {
                    // In case the local address is not allowed to read, we user another local address
                    SessionAddress sessAddr = new SessionAddress();
                    localAddr = new SessionAddress(sessAddr.getDataAddress(),
                            localPort);
                    rtpMgrs[i].initialize(localAddr);
                }

                rtpMgrs[i].addTarget(destAddr);

                System.err.println("Created RTP session at " + localPort + " to: " + remoteIpAddress + " " + port);

                sendStream = rtpMgrs[i].createSendStream(dataOutput, i);

                sendStreams.add(sendStream);

                sendStream.start();

            }
            catch (Exception e) {
                e.printStackTrace();
                return e.getMessage();
View Full Code Here

        PushBufferStream pbss[] = pbds.getStreams();

        rtpMgrs = new RTPManager[pbss.length];
        SessionAddress localAddr, destAddr;
        InetAddress ipAddr;
        SendStream sendStream;
        audioReceiver = new AudioReceiver(this, jingleMediaSession);
        int port;

        for (int i = 0; i < pbss.length; i++) {
            try {
                rtpMgrs[i] = RTPManager.newInstance();

                port = portBase + 2 * i;
                ipAddr = InetAddress.getByName(remoteIpAddress);

                localAddr = new SessionAddress(InetAddress.getByName(this.localIpAddress),
                        localPort);

                destAddr = new SessionAddress(ipAddr, port);

                rtpMgrs[i].addReceiveStreamListener(audioReceiver);
                rtpMgrs[i].addSessionListener(audioReceiver);

                BufferControl bc = (BufferControl) rtpMgrs[i].getControl("javax.media.control.BufferControl");
                if (bc != null) {
                    int bl = 160;
                    bc.setBufferLength(bl);
                }

                try {

                    rtpMgrs[i].initialize(localAddr);

                }
                catch (InvalidSessionAddressException e) {
                    // In case the local address is not allowed to read, we user another local address
                    SessionAddress sessAddr = new SessionAddress();
                    localAddr = new SessionAddress(sessAddr.getDataAddress(),
                            localPort);
                    rtpMgrs[i].initialize(localAddr);
                }

                rtpMgrs[i].addTarget(destAddr);

                LOGGER.error("Created RTP session at " + localPort + " to: " + remoteIpAddress + " " + port);

                sendStream = rtpMgrs[i].createSendStream(dataOutput, i);

                sendStreams.add(sendStream);

                sendStream.start();

            }
            catch (Exception e) {
                e.printStackTrace();
                return e.getMessage();
View Full Code Here

TOP

Related Classes of javax.media.rtp.SendStream

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.