RTP ReceiveStreamListener in Linux

Hi,
I have problem receiving an RTP stream by using a ReceiveStreamListener object, I am adding my object to RTPStreamMgr but the "update" method never gets called. I have changed my host ip in the /etc/hosts file to my "network IP" from loop-back IP so InetAddress.getLocalHost() works as in windows. Before that I wasn't able to send either. I have tested receiving with "JMStudio" and just worked, the program also works in windows. This is how I start my receiving session.
            mngrSession.addReceiveStreamListener(listener);
            InetAddress adr = InetAddress.getByName(destAddress);
            byte[] badr = adr.getAddress();
            InetAddress nadr = InetAddress.getByAddress(badr);
                mngrSession.initialize( new SessionAddress(InetAddress.getLocalHost(),localPort));
            mngrSession.addTarget(new SessionAddress(nadr, destPort));
            mngrSession.startSession();Any ideas on what I am doing wrong?
Thanks in advance,
-nw

Here, it is. Please have a look.
public synchronized void update(ReceiveStreamEvent event) {
        DataSource ds;       
     ReceiveStream stream = event.getReceiveStream();
        if (event instanceof NewReceiveStreamEvent) {
            stream = ((NewReceiveStreamEvent) event).getReceiveStream();
            ds = stream.getDataSource();
            try {
                player = javax.media.Manager.createPlayer(ds);
                if (player == null)
                    return;
                player.realize();
                while  (player.getState() != Player.Realized){
                    try {
                        Thread.sleep(100);
                        System.err.println("Realizing..");
                    } catch (InterruptedException ex) {
                        Logger.getLogger(RtpSession.class.getName()).log(Level.SEVERE, null, ex);
                player.start();   
            } catch (IOException ex) {
                Logger.getLogger(RtpSession.class.getName()).log(Level.SEVERE, null, ex);
            } catch (NoPlayerException ex) {
                Logger.getLogger(RtpSession.class.getName()).log(Level.SEVERE, null, ex);
    }

Similar Messages

  • RTP transmission in linux

    I am using linux for JMF RTP transmission.But the RTP data is not being transmitted.Can anyone suggest me the problem behind it.In windows its working fine.Is there any special configuration to be done on linux side for RTP transmission? I am using linux performance pack of JMF in linux machine.I also tried with cross platform pack of JMF.Thanks in advance...

    We finally did resolve this issue!!!!
    The thing is that Linux just behaves very different from Windows when you create Datagram or MultiCast's.
    Windows just assumes that localhost is the local ip address and Linux does not. When you do InetAddress.getLocalHost().getAddress() ; windows often returns the LAN ip address but linux returns localhost.
         InetSocketAddress local = new InetSocketAddress(InetAddress.getByAddress(new byte[]{(byte)192,(byte)168,(byte)3,(byte)2}),port);
         dataSock.bind(local);
         InetAddress destiny = InetAddress.getByAddress(new byte[]{(byte)224,(byte)1,(byte)1,(byte)0});
         dataSock2.connect(destiny, 9000);
    When you want to receive multicast packets you need to specify the network interface you access the multicast group. If you dont then it would just use InetAddress.getLocalHost().getAddress() as the address to reach the multicast group. In Linux this just does not work.
         MulticastSocket socket = new MulticastSocket(4446);
         InetAddress group = InetAddress.getByName("230.0.0.1");
         InetAddress address = InetAddress.getByName("192.168.3.2");
         NetworkInterface interf = NetworkInterface.getByInetAddress(address) ;
         SocketAddress socketAddress = new InetSocketAddress(group,4446) ;
         socket.joinGroup(socketAddress, interf );
    We are still working on making it work with broadcast addresses.
    Greetings!
    Nico and Charly

  • Problem to create RTP stream on Linux by using JMF studio

    Hello All,
    I am trying to use JMStudio in order to create RTP stream
    I have a problem with capture
    I have run Jmfinit I got following messages
    JavaSound Capture Supported = true
    JavaSoundAuto: Committed ok
    java.lang.Error: Can't open video card 0
    java.lang.Error: Can't open video card 1
    java.lang.Error: Can't open video card 2
    java.lang.Error: Can't open video card 3
    java.lang.Error: Can't open video card 4
    java.lang.Error: Can't open video card 5
    java.lang.Error: Can't open video card 6
    java.lang.Error: Can't open video card 7
    java.lang.Error: Can't open video card 8
    java.lang.Error: Can't open video card 9
    it seems to me that i have no directsoundcapture
    therefore i can not create RTP package stream
    How can i add direct sound capture to my capture devices.
    is there any suggestion for this issue?
    King regards
    BEKIR BALCIK
    ARGELA TECHNOLOGIES

    In $ORACLE_BASE/admin you should have a directory structure for the viton1 instance : create a similar directory structure for the viton2 instance.
    In the pfile subdirectory create the initviton2.ora file : you can copy it from initviton1.ora file and change all occurrences of viton1 to viton2.
    At OS prompt : export ORACLE_SID=viton2, then
    sqlplus /nolog
    conn / as sysdba
    startup nomount pfile=$ORACLE_BASE/admin/viton2/pfile/initviton2.ora
    then CREATE DATABASE.....

  • Not able to Transmit and receive RTP in Linux

    Friends,
    I am not able to receive the RTP stream transmitted from another Linux machine though I was trying doing it with JMStudio. The transmit shows as if it is working properly and JMStudio in the receiver machine keeps waiting. Tranmission and receiving between the two same machines when in windows is fine.
    Can anyone tell me what the problem is, do I have to add any feature to make this work in Linux.
    Sreekant

    I too am unable to transmit OR recieve RTP from Linux (RedHat 8.0). I am using JMF-2.1.1e and J2SDK 1.4.2.
    I can play files on Linux and I can transmit and recieve between Win boxes (98 and 2K) but my RedHat (8.0 and/or 7.3) can not send or recieve to anyone or anything. I have tried JMStudio and RTPPlayerApplet.
    TCPDUMP says udp port 22224 unreachable [tos 0xc0]
    JMStudio says that no data has arrived.
    I have all firewalling turned off and have tested on two different networks without success. All other networking functions are operational.
    My problem is identicle to the problem decribed in the following linked post.
    http://forum.java.sun.com/thread.jsp?thread=154947&forum=28&message=966551
    I also found another discussion that referenced big/little endian problems in the JMF implementation. (scary stuff)
    http://www.vovida.org/pipermail/rtp/2001-April/000112.html
    Any help or tips on resolving this issue are welcome. I will be happy to supply more info if needed. Also, if anyone has managed to get RTP working on Linux then what versions Linux/JDK/JMF, what program?
    Thanks in advance.

  • JMF and Linux troubles

    Hi All,
    Perhaps some of you with a bit more experience in this area can help me. Here's the situation:
    I open an RTP session (using jmstudio!) from Windows->Windows
    - result, I hear audio fine
    I open an RTP session from Linux->Linux
    - result, can't hear any audio
    I open an RTP session from Windows->Linux
    - where'd the audio go?
    RTP session from Linux->Windows
    - Audio seems fine
    It seems that my Linux machine cannot play any (arriving) audio sent over an RTP session. The strange part is that it can play a local audio file just fine, and it can transmit an audio file over the network. While transmitting the file it plays ok (it echoes the sound locally).
    Since I can hear sounds on this machine using other tools, I am assuming the sound card is configured correctly. Also I am assuming that the sound is physically being sent over the network (actually you can see it on the network monitor so this is true).
    Are there any possible reasons why I cannot hear the sound? I'm running redhat 8.0 and am using the i810_audio kernel module for my sound card. As far as I can tell everything should be going like blue blazes..

    Just in case anyone cares; I had to upgrade to the
    JDK1.4.2 (still beta as of the time of writing). There
    was a crucial javasound bug fix involved.Does that mean that you've solved the audio problem?
    Alex

  • Problem with Player (realize)

    Need help!!!
    At first use of the given class the player is not realized and there is no sound, events connected with realization of a player appear during the moment of its closing.
    At following use all works.
    Please help. Thanks in advance.
    package ua.cv.usl.sip.audio;
    import javax.media.Control;
    import javax.media.ControllerEvent;
    import javax.media.ControllerListener;
    import javax.media.Manager;
    import javax.media.Owned;
    import javax.media.Player;
    import javax.media.RealizeCompleteEvent;
    import javax.media.Renderer;
    import javax.media.control.BufferControl;
    import javax.media.rtp.RTPManager;
    import javax.media.rtp.ReceiveStream;
    import javax.media.rtp.ReceiveStreamListener;
    import javax.media.rtp.SessionListener;
    import javax.media.rtp.event.NewReceiveStreamEvent;
    import javax.media.rtp.event.ReceiveStreamEvent;
    import javax.media.rtp.event.SessionEvent;
    import com.sun.media.controls.GainControlAdapter;
    class AudioReceiver implements ReceiveStreamListener, SessionListener, ControllerListener {
         private GainControlAdapter gainControl = null;
         // link to MediaManager
         private MediaManager audioManager;
         // buffer param
         public static final int DEFAULT_BUFFER_LENGTH = 350; // 350;
         public static final int RENDER_BUFFER_LENGTH = 200;
         private RTPSocketAdapter connection;
         private Player player;
         public AudioReceiver(MediaManager aManager, RTPSocketAdapter connection) {
              audioManager = aManager;
              this.connection = connection;
         protected void setMute(boolean mute) {
              if (gainControl != null)
                   gainControl.setMute(mute);
         protected void setVolume(float vol) {
              if (gainControl != null)
                   gainControl.setLevel(vol);
         public synchronized void initialize() {
              audioManager.rtpSessions[1] = RTPManager.newInstance();
              audioManager.rtpSessions[1].addSessionListener(this);
              audioManager.rtpSessions[1].addReceiveStreamListener(this);
              audioManager.rtpSessions[1].initialize(connection);
              // initialize buffer
              BufferControl bc = (BufferControl) audioManager.rtpSessions[1].getControl("javax.media.control.BufferControl");
              if (bc != null) {
                   bc.setBufferLength(DEFAULT_BUFFER_LENGTH);
                   Control cs[] = audioManager.mediaProcessor.processor.getControls();
                   for (int j = 0; j < cs.length; j++)
                        if (cs[j] instanceof Owned && cs[j] instanceof BufferControl)
                             if (((Owned) cs[j]).getOwner() instanceof Renderer)
                                  ((BufferControl) cs[j]).setBufferLength(RENDER_BUFFER_LENGTH);
         public synchronized void stop() {
              player.stop();
              player.deallocate();
          * SessionListener.
         public void update(SessionEvent evt) {}
          * ReceiveStreamListener
         public void update(ReceiveStreamEvent evt) {
              if (evt instanceof NewReceiveStreamEvent) {
                   try {
                        ReceiveStream stream = ((NewReceiveStreamEvent) evt).getReceiveStream();
                        player = Manager.createPlayer(stream.getDataSource());
                        player.addControllerListener(this);
                        player.realize();
                   catch (Exception e) {
                        return;
          * ControllerListener for the Players.
         public void controllerUpdate(ControllerEvent ce) {
              if (player != null) {
                   if (ce instanceof RealizeCompleteEvent) {
                        player.start();
                        gainControl = (GainControlAdapter) player.getGainControl();
    }

    You code is fine.. Mine is about the same... I think the problem is outside AudioReceiver. Something's blocking your thread and doesnt let the Player start. Try starting receiver first, and then transmitter.
    Another wild guess: initialize your RTPManager before adding listeners.

  • Do any one kown how to encoder pcm to alaw if you use jmf?

    I'm have the problem about it how to encoder pcm to alaw?
    I find some code about it, but not work in jmf.
    A friend in forum tell me write it by myself , because jmf not support for alaw.
    But i'm new about this, so i want whether somebody could help me if you have the same code about this.
    code like this:
    capture.java
    * support : locator, datasource
    public class Capture extends MainFrame {
        private static final long serialVersionUID = 1L;
        private Processor cp = null;
        private Boolean isMix = false;
        private Boolean isUlaw = false;
        private MainFrame mf = null;
        public Capture(MainFrame mf, boolean useVideo) {
            this.isMix = useVideo;
            this.mf = mf;
        public Capture(MainFrame mf) {
            this.mf = mf;
        public Capture(boolean useVideo) {
            this.isMix = false;
        //get video MediaLocator
        public MediaLocator getVideoLocator() {
            MediaLocator VideoLocator = null;
            Vector VideoCaptureList = null;
            CaptureDeviceInfo VideoCaptureDeviceInfo = null;
            VideoFormat videoFormat = new VideoFormat(VideoFormat.YUV);
            VideoCaptureList = CaptureDeviceManager.getDeviceList(videoFormat);
            if (VideoCaptureList.size() > 0) {
                VideoCaptureDeviceInfo = (CaptureDeviceInfo) VideoCaptureList.elementAt(0);
                VideoLocator = VideoCaptureDeviceInfo.getLocator();
            } else {
    //--- Search video device
                VideoCaptureList = (Vector) CaptureDeviceManager.getDeviceList(null).clone();
                Enumeration getEnum = VideoCaptureList.elements();
                while (getEnum.hasMoreElements()) {
                    VideoCaptureDeviceInfo = (CaptureDeviceInfo) getEnum.nextElement();
                    String name = VideoCaptureDeviceInfo.getName();
                    if (name.startsWith("vfw:")) {
                        CaptureDeviceManager.removeDevice(VideoCaptureDeviceInfo);
                int nDevices = 0;
                for (int i = 0; i < 10; i++) {
                    String name = com.sun.media.protocol.vfw.VFWCapture.capGetDriverDescriptionName(i);
                    if (name != null && name.length() > 1) {
                        System.err.println("Found device" + name);
                        System.err.println("Querying device.Please wait....");
                        com.sun.media.protocol.vfw.VFWSourceStream.autoDetect(i);
                        nDevices++;
                VideoCaptureDeviceInfo = (CaptureDeviceInfo) CaptureDeviceManager.getDeviceList(videoFormat).elementAt(0);
                VideoLocator = VideoCaptureDeviceInfo.getLocator();
            return VideoLocator;
        //get audio MediaLocator
        public MediaLocator getAudioLocator() {
            MediaLocator AudioLocator = null;
            Vector AudioCaptureList = null;
            CaptureDeviceInfo AudioCaptureDeviceInfo = null;
            AudioFormat audioFormat = new AudioFormat(AudioFormat.LINEAR);
            AudioCaptureList = CaptureDeviceManager.getDeviceList(audioFormat);
            if (AudioCaptureList.size() > 0) {
                AudioCaptureDeviceInfo = (CaptureDeviceInfo) AudioCaptureList.elementAt(0);
                AudioLocator = AudioCaptureDeviceInfo.getLocator();
                System.out.println("get audio locator");
            } else {
                System.out.println("empty");
                AudioLocator = null;
            return AudioLocator;
        public DataSource getDataSource() {
            try {
                DataSource[] source = new DataSource[2];    //audio 0; video 1;
                source[0] = Manager.createDataSource(getAudioLocator());
                if (isMix) {
                    DataSource MixDataSource = null;
                    source[1] = Manager.createDataSource(getVideoLocator());
                    MixDataSource = Manager.createMergingDataSource(source);
                    return MixDataSource;
                } else {
                    return source[0];
            } catch (Exception ex) {
                System.out.println("---error0---" + ex);
                return null;
        public DataSource getDataSourceByProcessor() {
            StateHelper sh = null;
            DataSource OutDataSource = null;
            DataSource InputSource = null;
            InputSource = getDataSource();
            try {
                cp = Manager.createProcessor(InputSource);
            } catch (IOException ex) {
                System.out.println("---error1---" + ex);
            } catch (NoProcessorException ex) {
                System.out.println("---error2---" + ex);
            sh = new StateHelper(cp);
            if (!sh.configure(10000)) {
                System.out.println("Processor Configured Error!");
                System.exit(-1);
            ContentDescriptor cd = new ContentDescriptor(ContentDescriptor.RAW_RTP);
            cp.setContentDescriptor(cd);
            AudioFormat ulawFormat = new AudioFormat(AudioFormat.ULAW_RTP, 8000.0, 8, 1);
           // change encode to alaw here?
            TrackControl[] tracks = cp.getTrackControls();
            boolean encodingState = false;
            for (int i = 0; i < tracks.length; i++) {
                if (!encodingState && tracks[i] instanceof FormatControl) {
                    if (tracks.setFormat(ulawFormat) == null) {
    tracks[i].setEnabled(false);
    } else {
    encodingState = true;
    //---- ptime set
                   if (isUlaw) {
         try {
         System.out.println("Cambiando la lista de codecs...");
         Codec[] codec = new Codec[3];
         codec[0] = new com.ibm.media.codec.audio.rc.RCModule();
         codec[1] = new com.ibm.media.codec.audio.ulaw.JavaEncoder();
         //codec[2] = new com.ibm.media.codec.audio.ulaw.Packetizer();
         codec[2] = new com.sun.media.codec.audio.ulaw.Packetizer();
         ((com.sun.media.codec.audio.ulaw.Packetizer) codec[2]).setPacketSize(160);
         (tracks[i]).setCodecChain(codec);
         } catch (UnsupportedPlugInException ex) {
         } catch (NotConfiguredError ex) {
    } else {
    tracks[i].setEnabled(false);
    if (!encodingState) {
    System.out.println("Encode error");
    System.exit(-1);
    if (!sh.realize(10000)) {
    System.out.println("Processor Realized Error!");
    System.exit(-1);
    OutDataSource = cp.getDataOutput();
    return OutDataSource;
    //run
    public void start() {
    cp.start();
    //stop
    public void close() {
    cp.close();

    test.java (get outputDatasource form capture.java)
    package siphone.test;
    import java.io.IOException;
    import java.net.InetAddress;
    import javax.media.Format;
    import javax.media.Manager;
    import javax.media.Player;
    import javax.media.PlugInManager;
    import javax.media.control.BufferControl;
    import javax.media.format.UnsupportedFormatException;
    import javax.media.protocol.DataSource;
    import javax.media.protocol.PushBufferDataSource;
    import javax.media.protocol.PushBufferStream;
    import javax.media.rtp.InvalidSessionAddressException;
    import javax.media.rtp.Participant;
    import javax.media.rtp.RTPControl;
    import javax.media.rtp.RTPManager;
    import javax.media.rtp.ReceiveStream;
    import javax.media.rtp.ReceiveStreamListener;
    import javax.media.rtp.SendStream;
    import javax.media.rtp.SendStreamListener;
    import javax.media.rtp.SessionAddress;
    import javax.media.rtp.SessionListener;
    import javax.media.rtp.event.ByeEvent;
    import javax.media.rtp.event.NewParticipantEvent;
    import javax.media.rtp.event.NewReceiveStreamEvent;
    import javax.media.rtp.event.NewSendStreamEvent;
    import javax.media.rtp.event.ReceiveStreamEvent;
    import javax.media.rtp.event.RemotePayloadChangeEvent;
    import javax.media.rtp.event.SendStreamEvent;
    import javax.media.rtp.event.SessionEvent;
    import javax.media.rtp.rtcp.SourceDescription;
    import siphone.decode.AlawRtpDecoder;
    import siphone.device.Capture;
    import siphone.gui.MainFrame;
    * @author kaiser
    public class Dial implements SessionListener, ReceiveStreamListener, SendStreamListener {
        private String ip = null;
        private int TargetPort;
        private int LocalPort;
        private MainFrame mf = null;
        private Capture capture = null;
        private DataSource oDataSource = null;
        private RTPManager rtp = null;
        private SendStream stream = null;
        private Player play = null;
        private Boolean LogStatu = false;
        static private Format AlawRtpFormat;
        public Dial(String ip, String rport, int lport, MainFrame mf) {
            this.ip = ip;
            this.TargetPort = Integer.parseInt(rport);
            this.LocalPort = lport;
            this.mf = mf;
            capture = new Capture(false);
            oDataSource = capture.getDataSourceByProcessor();
        public static void main(String[] args) throws IOException {
            Dial dial = new Dial("192.168.200.40", "40000", 10000, null);
            dial.Init();
            System.in.read();
            dial.stop();
        public synchronized void Init() {
            PushBufferDataSource pushDataSource = (PushBufferDataSource) oDataSource;
            PushBufferStream pushStream[] = pushDataSource.getStreams();
            SessionAddress localAddress, targetAddress;
            try {
                rtp = RTPManager.newInstance();
                rtp.addReceiveStreamListener(this);
                rtp.addSendStreamListener(this);
                rtp.addSessionListener(this);
                //port: TargetPort or LocalPort;
                localAddress = new SessionAddress(InetAddress.getLocalHost(), TargetPort);
                targetAddress = new SessionAddress(InetAddress.getByName(ip), TargetPort);
                rtp.initialize(localAddress);
                rtp.addTarget(targetAddress);
                BufferControl bc = (BufferControl) rtp.getControl("javax.media.control.BufferControl");
                if (bc != null) {
                    bc.setBufferLength(100);
                stream = rtp.createSendStream(oDataSource, 0);
                stream.start();
                capture.start();
                System.out.println("voice starting...........\n");
            } catch (UnsupportedFormatException ex) {
                System.err.println("error0:\n" + ex);
            } catch (InvalidSessionAddressException ex) {
                System.err.println("error1:\n" + ex);
            } catch (IOException ex) {
                System.err.println("error2:\n" + ex);
        //stop
        public void stop() {
            capture.close();
            if (rtp != null) {
                rtp.removeTargets("close session");
                rtp.dispose();
                rtp = null;
            System.out.println("close session...........\n");
        public void update(SessionEvent evt) {
            if (evt instanceof NewParticipantEvent) {
                Participant sPart = ((NewParticipantEvent) evt).getParticipant();
                System.out.print("  - join: " + sPart.getCNAME());
        public void update(ReceiveStreamEvent rex) {
            ReceiveStream rStream = rex.getReceiveStream();
            Participant rPart = rex.getParticipant();
            if (rex instanceof NewReceiveStreamEvent) {
                try {
                    DataSource rData = rStream.getDataSource();
                    RTPControl rcl = (RTPControl) rData.getControl("javax.media.rtp.RTPControl");
                    if (rcl != null) {
                        System.out.print("  - receive RTPControl info | the AudioFormat: " + rcl.getFormat());
                    } else {
                        System.out.print("  - receive RTPControl info");
                    if (rPart == null) {
                        System.out.print(" UNKNOWN");
                    } else {
                        System.out.print("data form " + rPart.getCNAME());
                    play = Manager.createRealizedPlayer(rData);
                    if (play != null) {
                        play.start();
                } catch (Exception ex) {
                    System.out.print("NewReceiveStreamEvent Exception " + ex.getMessage());
                    return;
            } else if (rex instanceof ByeEvent) {
                System.out.print("  - receive bye message: " + rPart.getCNAME() + "   exit");
                stop();
                return;
    }Anyone can tell me how to do?
    Thank you very much!

  • RTPPeer To Peer live capture

    Hi I think I am doing what I have read in JMF documentation and examples but I am not able to see visual component in JFrame. I did selected Lightweight component in Manager. And I also see packets going back and forth in wireshark but I do not hear any audio.
    Please see the following code and let me know if find anything wrong...Thanks in advance.
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package rtppeertopeer;
    import java.util.Vector;
    import java.net.InetAddress;
    import java.awt.Component;
    import javax.swing.JComponent;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.media.Buffer;
    import javax.media.MediaLocator;
    import javax.media.CaptureDeviceInfo;
    import javax.media.CaptureDeviceManager;
    import javax.media.Player;
    import javax.media.ControllerEvent;
    import javax.media.ControllerListener;
    import javax.media.Processor;
    import javax.media.rtp.Participant;
    import javax.media.rtp.SendStream;
    import javax.media.rtp.ReceiveStreamListener;
    import javax.media.rtp.SessionListener;
    import javax.media.rtp.event.*;
    import javax.media.rtp.ReceiveStream;
    import javax.media.Manager;
    import javax.media.rtp.RTPManager;
    import javax.media.format.AudioFormat;
    import javax.media.protocol.ContentDescriptor;
    import javax.media.protocol.DataSource;
    import java.io.IOException;
    import javax.media.format.UnsupportedFormatException;
    import javax.media.NoPlayerException;
    * @author lbana
    public class RTPPeerToPeer extends JPanel
    implements ReceiveStreamListener, SessionListener, ControllerListener {
    private Processor m_capProcessor;
    private Player m_player;
    private DataSource m_dataSource;
    private RTPManager m_rtpManager;
    private RTPSocketAdapter m_rtpSock;
    private SendStream m_sendStream;
    private LocalProcessor m_localProcessor;
    private JPanel m_jpanel;
    private JFrame m_jframe;
    public RTPPeerToPeer(String ipaddr, int port)
    try
    m_localProcessor = new LocalProcessor();
    /* Server and Client uses same address */
    InetAddress iaddr = InetAddress.getByName(ipaddr);
    m_rtpManager = RTPManager.newInstance();
    m_rtpSock = new RTPSocketAdapter(iaddr, port);
    m_rtpManager.initialize(m_rtpSock);
    m_sendStream = m_rtpManager.createSendStream(m_dataSource, 0);
    registerManagerSessionListeners();
    m_sendStream.start();
    catch (UnsupportedFormatException exe)
    exe.printStackTrace();
    catch (IOException exe)
    exe.printStackTrace();
    public void setJFrame(JFrame frm)
    m_jframe = frm;
    public void registerManagerSessionListeners()
    m_rtpManager.addReceiveStreamListener(this);
    public void start()
    m_capProcessor.start();
    public void stop() throws IOException
    m_capProcessor.stop();
    m_sendStream.stop();
    public void close()
    m_capProcessor.close();
    m_sendStream.close();
    public void controllerUpdate(ControllerEvent evt)
    public void update(ReceiveStreamEvent evt)
    RTPManager mgr = (RTPManager)evt.getSource();
    System.out.println(evt.toString());
    if (evt instanceof ActiveReceiveStreamEvent)
    ActiveReceiveStreamEvent arstrm = (ActiveReceiveStreamEvent)evt;
    System.out.println(arstrm.toString());
    else if (evt instanceof InactiveReceiveStreamEvent)
    InactiveReceiveStreamEvent irstrm = (InactiveReceiveStreamEvent)evt;
    System.out.println(irstrm.toString());
    else if (evt instanceof NewReceiveStreamEvent)
    NewReceiveStreamEvent nstrevt = (NewReceiveStreamEvent)evt;
    ReceiveStream strm = nstrevt.getReceiveStream();
    Participant participant = nstrevt.getParticipant();
    DataSource ds = strm.getDataSource();
    System.out.println(nstrevt.toString());
    if (participant != null)
    System.out.println(participant.toString());
    try
    * Player for inbound RTP packets.
    m_player = Manager.createPlayer(ds);
    m_player.addControllerListener(this);
    Statehelper procHelper = new Statehelper(m_player);
    procHelper.configure(1000);
    procHelper.realize(5000);
    JComponent visComp = (JComponent)m_player.getVisualComponent();
    JComponent ctrlComp = null; //(JComponent)m_player.getControlPanelComponent();
    if (visComp != null)
    //add(visComp);
    else
    System.out.println("Component is NULL");
    if (ctrlComp != null)
    add(ctrlComp);
    repaint();
    catch (NoPlayerException exe)
    exe.printStackTrace();
    catch (IOException exe)
    exe.printStackTrace();
    else if (evt instanceof RemotePayloadChangeEvent)
    else if (evt instanceof StreamMappedEvent)
    else if (evt instanceof TimeoutEvent)
    else
    public void update(SessionEvent evt)
    System.out.println(evt.toString());
    if (evt instanceof LocalCollisionEvent)
    LocalCollisionEvent levt = (LocalCollisionEvent)evt;
    System.out.println(levt.toString());
    else if (evt instanceof NewParticipantEvent)
    RTPManager mgr = (RTPManager)evt.getSource();
    NewParticipantEvent npart = (NewParticipantEvent)evt;
    Participant nusr = npart.getParticipant();
    System.out.println(nusr.getCNAME());
    System.out.println(nusr.toString());
    else
    System.out.println("Unknown SessionEvent received.");
    * Constructing Processor for Microphone.
    class LocalProcessor
    public LocalProcessor()
    m_capProcessor = createProcessor();
    m_dataSource = m_capProcessor.getDataOutput();
    public Processor createProcessor()
    Processor processor = null;
    Statehelper procHelper = null;
    AudioFormat frmt = new AudioFormat(AudioFormat.LINEAR,
    44100, /* Sampling */
    16, /* num of bits */
    1); /* mono */
    Vector<CaptureDeviceInfo> devList =
    CaptureDeviceManager.getDeviceList(frmt);
    for (int i = 0; i < devList.size(); i++)
    System.out.println(devList.get(i).toString());
    if (devList.size() == 0)
    System.out.println("CaptureDeviceManager could not locate devinfo");
    return null;
    CaptureDeviceInfo cdev = devList.get(0);
    try
    /* Processor for transmitting captured source from Microphone. */
    processor = Manager.createProcessor(cdev.getLocator());
    procHelper= new Statehelper(processor);
    procHelper.configure(1000);
    processor.setContentDescriptor(new ContentDescriptor(ContentDescriptor.RAW_RTP));
    procHelper.realize(1000);
    catch (Exception exe)
    exe.printStackTrace();
    return processor;
    }

    Thanks for the response...I haven't pasted my complete source code. Statehelper.java is Sunjava jmf implementation. Here is my
    main.
    public static void constructGUI(String ipaddr, int port)
            JFrame.setDefaultLookAndFeelDecorated(true);
            JFrame    frame = new JFrame("My Frame");
            Dimension dim   = new Dimension(300, 600);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setPreferredSize(dim);
            RTPPeerToPeer rtp = new RTPPeerToPeer(ipaddr, port);
            frame.getContentPane().add(rtp);
            //jmfc.createRecord();
            frame.pack();
            frame.setVisible(true);
            rtp.start();
        }Seems like I selected "code" but didn't look like it enabled in my previous post....pls ignore the previous.
    sorry for the noise

  • Pleaseeeeeeeeeee help

    AudioConf.java is the server code which sends the audio file which is saved in the disk.
    Client.java is the receiver code which is supposed to receive which is not happening.
    The client does not receive any stream but it can detect the new participant can u please give directions in what might be the problem.
    //import java awt and net features
    import java.awt.*;
    import java.awt.event.*;
    import java.util.Vector;
    import java.net.*;
    import java.lang.String;
    import java.io.*;
    // import javax media features
    import javax.media.*;
    import javax.media.Processor;
    import javax.media.Multiplexer;
    import javax.media.control.*;
    import javax.media.control.TrackControl;
    import javax.media.control.BufferControl;
    import javax.media.format.*;
    import javax.media.format.AudioFormat;
    import javax.media.protocol.*;
    import javax.media.protocol.DataSource;
    import javax.media.protocol.PushDataSource;
    //import javax rtp features
    import javax.media.rtp.*;
    import javax.media.rtp.SendStream;
    import javax.media.rtp.event.RTPEvent;
    import javax.media.rtp.rtcp.SourceDescription;
    //import swing features
    import javax.swing.*;
    import javax.swing.event.*;
    //import sun.com
    import com.sun.media.*;
    import com.sun.media.rtp.RTPSessionMgr;
    public class AudioConf extends JFrame implements ControllerListener
    Container frameContainer;
    JMenuBar menuBar = new JMenuBar();
    JMenu fileMenu = new JMenu("File");
    JMenuItem fileExit = new JMenuItem("Exit");
    JMenu playerMenu = new JMenu("Player");
    JMenuItem playerCapture = new JMenuItem("Capture");
    JMenuItem playerTransmit = new JMenuItem("Transmit");
    JSeparator sep3 = new JSeparator();
    JMenuItem playerPlay = new JMenuItem("Play");
    JSeparator sep4 = new JSeparator();
    JMenuItem playerStop = new JMenuItem("Stop");
    JMenu helpMenu = new JMenu("Help");
    JMenuItem helpAbout = new JMenuItem("About");
    CaptureDeviceInfo audioCDI = null;
    String audioDeviceName=null;
    Player audioPlayer=null;
    Format audioFormat;
    DataSource dataSource;
    MediaLocator ml;
    Processor p = null;
    DataSource ds = null;
    CaptureDeviceInfo di=null;
    Vector devicelist;
    Thread recordthread;
    boolean keepRun;
    Button stopb;
    boolean result;
    DataSink filewriter = null;
    MediaLocator dest;
    Panel capturePanel;
    boolean looping= true;
    RTPManager rtpMgrs[];
    int port = 3000;
    DataSource dataOut = null;
    Component visualComponent=null;
    Component controllerComponent=null;
    Player dualPlayer = null;
    String contentType="raw";
    boolean connected = false;
    // MAIN FUNCTION
    public static void main(String args[])
    AudioConf conf = new AudioConf();
    }//end of main
    AudioConf()
    buildGUI();
    setupHandlers();
    setSize(400,400);
    setTitle("Audio Conference");
    show();
    }//end of audioconf constructor
    //build the graphical user interface necessary
    void buildGUI()
    setupMenuBar();
    layoutComp();
    }//end of buildGUI
    // setup the menu bar
    void setupMenuBar()
         fileMenu.add(fileExit);
         playerMenu.add(playerCapture);
         playerMenu.add(playerTransmit);
         playerMenu.add(sep3);
         playerMenu.add(playerPlay);
         playerMenu.add(sep4);
         playerMenu.add(playerStop);
         helpMenu.add(helpAbout);
         menuBar.add(fileMenu);
         menuBar.add(playerMenu);
         menuBar.add(helpMenu);
         setJMenuBar(menuBar);
    }//end of setupMenuBar
    //setup the layout componenets
    public void layoutComp()
         frameContainer = getContentPane();
    frameContainer.setLayout(new BorderLayout());      
         }//end of layoutComp()
    // setup the handlers to events
    void setupHandlers()
         addWindowListener(new WindowHandler());
    fileExit.addActionListener(new MenuItemHandler());
         playerCapture.addActionListener(new MenuItemHandler());
              playerTransmit.addActionListener(new MenuItemHandler());          
         playerPlay.addActionListener(new MenuItemHandler());
         playerStop.addActionListener(new MenuItemHandler());
         helpAbout.addActionListener(new MenuItemHandler());
         }//end of setupHandlers
    // function for window closing event
    public class WindowHandler extends WindowAdapter
    public void windowClosing(WindowEvent e)
    System.exit(0);
    }//end of windowclosing
    }//end of windowhandler
    public class MenuItemHandler implements ActionListener
    CaptureDeviceInfo audioCDI = null;
    String audioDeviceName=null;
    Player audioPlayer=null;
    Format audioFormat;
    DataSource dataSource;
    public void actionPerformed(ActionEvent e)
    String cmd = e.getActionCommand();
    if(cmd.equals("Play"))
    playMedia();
    }//end of play
    else if(cmd.equals("Capture"))
    captureMedia();
    else if(cmd.equals("Transmit"))
    transmitMedia();
    }//end of transmitMedia
    else if(cmd.equals("Stop"))
    stopmedia();
    else if(cmd.equals("Exit"))
    System.exit(0);
    }//end of actionPerformed
    }//end of MenuItemHandler
    //*************************************Player******************************************************
    void playMedia()
    try
    FileDialog fd=new FileDialog(AudioConf.this,"Select the file",FileDialog.LOAD);
    fd.setVisible(true);
    String filename = fd.getDirectory() + fd.getFile();
    dualPlayer = Manager.createPlayer(new MediaLocator("file:///" + filename));
    System.out.println("Adding controller listener");
    dualPlayer.addControllerListener(this);
    System.out.println("Starting player ...");
    dualPlayer.start();
    catch (Exception ex)
    System.out.println(ex.toString());
    }//end of playMedia
    //************************************CONTROLLER UPDATE*************************************************
    public synchronized void controllerUpdate(ControllerEvent ce)
         if (ce instanceof RealizeCompleteEvent)
              Component comp;
              System.out.println("Adding visual component");
              if ((comp = dualPlayer.getVisualComponent()) != null)
              frameContainer.add ("Center", comp);
              System.out.println("Adding control panel");
              if ((comp = dualPlayer.getControlPanelComponent()) != null)
              frameContainer.add("South", comp);
              validate();
         else if( ce instanceof DurationUpdateEvent)
         Time duration= ((DurationUpdateEvent) ce).getDuration();
         System.out.println( "duration: " + duration.getSeconds());
         else if( ce instanceof EndOfMediaEvent)
              System.out.println( "END OF MEDIA - looping=" + looping);
                   if( looping)
                        p.setMediaTime( new Time( 0));
                             p.start();
    //******************************Stop Playing**************************************************
    public void stopmedia()
         if(dualPlayer!=null)
    dualPlayer.close();
         dualPlayer.deallocate();
         validate();
    //*************************************Capturing***************************************************
    // Capture the media using datasource and save it using datasink
    void captureMedia()
    captureDialogBox captureDialog=new captureDialogBox(AudioConf.this,"CAPTURE MEDIA",false);
    captureDialog.show();
    class captureDialogBox extends Dialog implements ActionListener,Runnable
    captureDialogBox(Frame parent, String title, boolean mode)
    super(parent, title, mode);
    setSize(450, 180);
    setTitle("Capture");
    capturePanel = new Panel();
    capturePanel.setLayout(new BorderLayout());
         CaptureDeviceInfo di=null;
         Vector devicelist;
         keepRun = true;
              stopb = new Button("Stop");
    capturePanel.add("South",stopb);
    add(capturePanel,"Center");
              stopb.addActionListener(this);
    devicelist = CaptureDeviceManager.getDeviceList(new AudioFormat("linear",44100,16,2));
    if(devicelist.size() > 0)
    di=(CaptureDeviceInfo)devicelist.firstElement();
    else
    System.exit(-1);
    ml=di.getLocator();
    System.out.println(ml);
         // Create a DataSource given the media locator.
    try {
    p = Manager.createProcessor(ml);
    p.configure();
              result = waitForState(p,Processor.Configured);
    System.out.println("Configure over ");
    p.setContentDescriptor(new FileTypeDescriptor(FileTypeDescriptor.BASIC_AUDIO));
    p.realize();
              result = waitForState(p,Processor.Realized);
    System.out.println("Realized");
    controllerComponent = p.getControlPanelComponent();
    if(controllerComponent!=null)
    capturePanel.add("North",controllerComponent);
    visualComponent = p.getVisualComponent();
    if(visualComponent!=null)
    capturePanel.add("Center",visualComponent);
    validate();
    ds = p.getDataOutput();
    catch (Exception e)
    System.out.println("Cannot create DataSource from: " + ml + e.toString());
    System.exit(0);
    dest = new MediaLocator("file://c:\\jo\\Test.au");
    try {
    if(ds == null)
    System.out.println("Source null ");
    filewriter = Manager.createDataSink(ds, dest);
    if (filewriter == null)
    System.err.println("Failed to create a DataSink");
    catch (NoDataSinkException e)
    System.out.println("Error in store NoDataSinkException "+e.toString());
    System.exit(-1);
    catch (SecurityException e)
    System.out.println("Error in store SecurityException "+e.toString());
    System.exit(-1);
              try
    filewriter.open();
    p.start();
    filewriter.start();
    catch (IOException e)
    System.out.println("Error Line abc in store IOException "+e.toString());
    System.exit(-1);
    recordthread = new Thread(this);
    recordthread.start();
    public void run()
    while(keepRun)
    System.out.println("Just record");
    try{
    recordthread.sleep(50);
    }catch(Exception ex){
    System.out.println("Line sss");
    }//end of while
    try{
    filewriter.close();
    }catch(Exception ex){
    System.out.println("Error in closing ");
    }//end of run
    public void actionPerformed(ActionEvent ae)
    keepRun = false;
    //System.exit(0);
    System.out.println("REcord Over");
    recordthread.suspend();
    dispose();
    //*************************************************Transmission***************************************
    void transmitMedia()
    try {
    MediaLocator playerloc = new MediaLocator("file://c:\\jo\\Test.au");
    System.out.println(playerloc);
    p = Manager.createProcessor(playerloc);
    p.configure();
    result = waitForState(p,Processor.Configured);
    System.out.println("Configure over ");
              ContentDescriptor cd = new ContentDescriptor(ContentDescriptor.RAW_RTP);
              p.setContentDescriptor(cd);
    TrackControl track[]=p.getTrackControls();
    boolean encodingPossible = false;
    for(int i = 0;i<track.length;i++)
    if(!encodingPossible && track[i] instanceof FormatControl)
    try
    ((FormatControl)track).setFormat(new AudioFormat(AudioFormat.ULAW_RTP,8000,8,1));
    encodingPossible = true;
    }//end of try
    catch(Exception e)
              System.out.println("IncompatibleFormatException ");
    }//end of if
              else
                   System.out.println("else part");
    track[i].setEnabled(false);
                   }//end of else
    }//end of for
    p.realize();
              boolean result=waitForState(p,Processor.Realized);
    System.out.println("Realized");
    System.out.println("Datasource created successfully");
         catch(Exception ex)
         System.out.println("EXception in creating processor");
    try
    dataOut=p.getDataOutput();
    System.out.println(dataOut.toString());
    catch(NotRealizedError e)
    System.out.println("NotRealizedError");
    if(dataOut==null)
    System.out.println("Dataout is null");
    PushBufferDataSource pbds = (PushBufferDataSource)dataOut;
    System.out.println("pbds =" + pbds.toString());
         PushBufferStream pbss[] = pbds.getStreams();
    System.out.println("pbss length = " + pbss.length);
         rtpMgrs = new RTPManager[pbss.length];
         SessionAddress localAddr, destAddr;
         InetAddress ipAddr;
         SendStream sendStream;
         SourceDescription srcDesList[];
         for (int i = 0; i < pbss.length; i++)
         try
              rtpMgrs[i] = RTPManager.newInstance();     
    System.out.println("rtpMgrs created using new instance");
         System.out.println("port = " + port);
    ipAddr = InetAddress.getLocalHost();     
              InetAddress hostAddr= InetAddress.getLocalHost();
    System.out.println("Local host= " + hostAddr);
              localAddr = new SessionAddress( hostAddr,3000);
    System.out.println("localAddr = " + localAddr);
    destAddr = new SessionAddress( ipAddr, 4000);
    System.out.println("destAddr = " + destAddr);
    rtpMgrs[i].initialize(localAddr);
              rtpMgrs[i].addTarget(destAddr);
              System.out.println( "Created RTP session: ");
              sendStream = rtpMgrs[i].createSendStream(dataOut, i);          
    System.out.println("stream send created");
    sendStream.start();
    System.out.println("sendstream started");
         catch (Exception e)
              System.out.println("Error"+e.toString());
              e.printStackTrace();
    }//end of for
    }//end of transmitMedia
    // ***********************************STATE LOCK**********************************************
    private Integer stateLock = new Integer(0);
    private boolean failed = false;
    Integer getStateLock() {
         return stateLock;
    void setFailed() {
         failed = true;
    // *******************************************WAIT FOR STATE METHOD *********************
    private synchronized boolean waitForState(Processor p, int state) {
         p.addControllerListener(new StateListener());
         failed = false;
         // Call the required method on the processor
         if (state == Processor.Configured)
         p.configure();
         else if (state == Processor.Realized)
         p.realize();
         // Wait until we get an event that confirms the
         // success of the method, or a failure event.
         // See StateListener inner class
         while (p.getState() < state && !failed)
         synchronized (getStateLock())
              try
              getStateLock().wait();
    catch (InterruptedException ie)
              return false;
         if (failed)
         return false;
         else
         return true;
    // ********************************* STATE LISTENER *************************************
    class StateListener implements ControllerListener
         public void controllerUpdate(ControllerEvent ce)
         // If there was an error during configure or
         // realize, the processor will be closed
         if (ce instanceof ControllerClosedEvent)
              setFailed();
         // All controller events, send a notification
         // to the waiting thread in waitForState method.
         if (ce instanceof ControllerEvent)
              synchronized (getStateLock())
              getStateLock().notifyAll();
    }//end of audioconf class
    Client program - this program receives the stream and play it
    //import awt and net features
    import java.awt.*;
    import java.awt.event.*;
    import java.util.Vector;
    import java.net.*;
    import java.lang.String;
    import java.io.*;
    // import the media features
    import javax.media.*;
    import javax.media.MediaEvent;
    import javax.media.Processor;
    import javax.media.Multiplexer;
    import javax.media.control.*;
    import javax.media.control.TrackControl;
    import javax.media.control.BufferControl;
    import javax.media.format.*;
    import javax.media.format.AudioFormat;
    import javax.media.protocol.*;
    import javax.media.protocol.DataSource;
    import javax.media.rtp.*;
    import javax.media.rtp.event.*;
    import javax.media.rtp.rtcp.*;
    import javax.media.rtp.event.RTPEvent;
    import javax.media.rtp.RTPManager;
    import javax.media.rtp.ReceiveStreamListener;
    import javax.media.rtp.rtcp.SourceDescription;
    // import the swing features
    import javax.swing.*;
    import javax.swing.event.*;
    // for sessionmedia
    import com.sun.media.*;
    import com.sun.media.rtp.RTPSessionMgr;
    // for PlayerWindow
    import com.sun.media.ui.*;
    public class client extends JFrame implements ReceiveStreamListener,ControllerListener,SessionListener
    Vector playerlist = new Vector();
    RTPManager mgr = null;
    boolean terminatedbyClose = false;
    String address="127.0.0.1";
    int port=4000;
    int ttl=100;
    DataSink filewriter = null;
    DataSource dsource=null;
    Container frameContainer;
    MediaLocator f=null;
    JMenuBar menuBar = new JMenuBar();
    JMenu fileMenu = new JMenu("File");
    JMenuItem fileExit = new JMenuItem("Exit");
    JMenu playerMenu = new JMenu("Player");
    JMenuItem playerReceive = new JMenuItem("Receive");
    JMenuItem playerIgnore = new JMenuItem("Stop");
    client()
    buildGUI();
    setupHandlers();
    setSize(400,400);
    setTitle("Audio Conference");
    show();
    }//end of audioconf constructor
    //build the graphical user interface necessary
    void buildGUI()
    setupMenuBar();
    layoutComp();
    }//end of buildGUI
    // setup the menu bar
    void setupMenuBar()
         fileMenu.add(fileNew);
         fileMenu.add(sep1);
         fileMenu.add(fileClose);
         fileMenu.add(sep2);
         fileMenu.add(fileExit);
         playerMenu.add(playerReceive);
         playerMenu.add(playerIgnore);
         menuBar.add(fileMenu);
         menuBar.add(playerMenu);
    setJMenuBar(menuBar);
    }//end of setupMenuBar
    //setup the layout componenets
    public void layoutComp()
         frameContainer = getContentPane();
    frameContainer.setLayout(new BorderLayout());      
         }//end of layoutComp()
    // setup the handlers to events
    void setupHandlers()
         addWindowListener(new WindowHandler());
         fileNew.addActionListener(new MenuItemHandler());
    fileClose.addActionListener(new MenuItemHandler());
    fileExit.addActionListener(new MenuItemHandler());
         playerReceive.addActionListener(new MenuItemHandler());
              playerIgnore.addActionListener(new MenuItemHandler());          
         }//end of setupHandlers
    // function for window closing event
    public class WindowHandler extends WindowAdapter
    public void windowClosing(WindowEvent e)
    System.exit(0);
    }//end of windowclosing
    }//end of windowhandler
    // menuItem handler class to get action from menu items
    public class MenuItemHandler implements ActionListener
         public void actionPerformed(ActionEvent e)
    String cmd = e.getActionCommand();
    if(cmd.equals("Exit"))
    System.exit(0);
    else if(cmd.equals("Receive"))
              receiveData();
    }//end of play
    else if(cmd.equals("Ignore"))
    ignoreData();
    }//end of actionPerformed
    }//end of menuitemhandler
    /* *******************************IGNORE STREAM**************** */
    void ignoreData()
    IgnoreDialog igDialog=new IgnoreDialog(client.this,"IGNORE THE STREAM",false);
    igDialog.show();
    }//end of ignoreData
    class IgnoreDialog extends Dialog implements ActionListener
         // constructor
    IgnoreDialog(Frame parent, String title, boolean mode)
    super(parent, title, mode);
    setSize(250, 120);
    Panel p = new Panel();
    p.setLayout(null);
    Label display = new Label("The Stream sent has been ignored");
    Button OKbutton = new Button("OK");
              p.add(display);
    display.setBounds(5, 5, 200, 20);
              p.add(OKbutton);
    OKbutton.setBounds(80, 50, 60, 25);
              add(p, "Center");
              OKbutton.addActionListener(this);
              }//end of constructor
    //actionPerformed in the dialog box
         public void actionPerformed(ActionEvent ae)
    dispose();
    }//end of actionperformed
    }//end of IgnoreDialog class
    /* *******************************RECEIVE STREAM**************** */
    // receive the data
    void receiveData()
    SessionAddress localaddr = null;
    SessionAddress remoteaddr = null;
    InetAddress destaddr = null;
    mgr = RTPManager.newInstance();
    System.out.println("mgr is created");
         if (mgr == null)
              System.out.println("Manager is null");
         mgr.addFormat(new AudioFormat(AudioFormat.DVI_RTP,44100,4,1),18);
         // Register RecvStreamListener with the session manager
    try
    destaddr = InetAddress.getLocalHost();
         localaddr = new SessionAddress(destaddr,4000);
    remoteaddr = new SessionAddress(destaddr,3000);
         System.out.println("local addr : " + localaddr);
         System.out.println("remote addr : " + remoteaddr);
         mgr.initialize(localaddr);
         mgr.addTarget(remoteaddr);
    mgr.addSessionListener(this);
         mgr.addReceiveStreamListener(this);
    System.out.println("mgr initialised");
    BufferControl bc = (BufferControl)mgr.getControl("javax.media.control.BufferControl");
              if (bc != null)
              bc.setBufferLength(350);
    catch(Exception e)
         System.out.println("initialized error" + e.toString());
    }//end of receiveData
    * SessionListener.
    public synchronized void update(SessionEvent evt)
         if (evt instanceof NewParticipantEvent)
         Participant p = ((NewParticipantEvent)evt).getParticipant();
         System.err.println(" - A new participant had just joined: " + p.getCNAME());
    public synchronized void update(ReceiveStreamEvent event)
              Player newplayer = null;
              RTPPlayerWindow playerWindow = null;
         Vector streams = null;
    ReceiveStream stream = null;
         // find the sourceRTPSM for this event
    try
    Participant part1 = event.getParticipant();
              streams = part1.getStreams();
              System.out.println("Streams Length "+streams.size());
              RTPManager source =(RTPManager) event.getSource();
              System.out.println(" source " + source);
              System.out.println("inside source try");
              stream = event.getReceiveStream();
              System.out.println("STream received : =" + stream.toString());
         catch(Exception e)
              System.out.println("Source not obtained" + e.toString());
    System.out.println("outside try-catch");
         // create a new player if a new recvstream is detected
    try
                        System.out.println("entered try ");
    dsource = stream.getDataSource();
                        System.out.println("Dsource is obtained " + dsource);
                        f = new MediaLocator("file://c:\\jo1\foo.au");
                        catch(Exception e)
                             System.out.println("Dsource exception = "+ e.toString());
                        try
                        filewriter = Manager.createDataSink(dsource, f);
    System.out.println("Datasink created");
                        catch(Exception e)
                             System.out.println("Datasink exception = "+ e.toString());
         if (event instanceof NewReceiveStreamEvent)
              String cname = "Java Media Player";
              //ReceiveStream stream = null;
                   try
                   // get a handle over the RTPRecvStream
                        stream = ((NewReceiveStreamEvent)event).getReceiveStream();
                        System.out.println("straem : " +stream);
                        Participant part = stream.getParticipant();
                        System.out.println("partcipant : " + part);
                        if (part != null)
                             cname = part.getCNAME();
                             System.out.println("Cname = " + cname);
                   // get a handle over the RecvStream datasource
    /*                    DataSource dsource = stream.getDataSource();
                        MediaLocator f = new MediaLocator("file://c:\foo.au");
                        Manager.createDataSink(dsource, f);
    System.out.println("Datasink created");
                   // create a player by passing datasource to the Media Manager
                        newplayer = Manager.createPlayer(dsource);
                        System.out.println("created player " + newplayer);
                   catch (Exception e)
                        System.out.println("newRecvStreamEvent exception " +e.getMessage());
              if (newplayer == null)
                   System.out.println("new player is null");
              playerlist.addElement(newplayer);
              newplayer.addControllerListener(this);
              // send this player to player GUI
              playerWindow = new RTPPlayerWindow( newplayer, cname );
              }// instanceof newRecvStreamEvent
         }// end of update(RTPRecvStreamEvent)
    public void controllerUpdate(ControllerEvent evt)
              // get a handle over controller, remove it from the player list
              // if player list is empty, close the sesssion manager.
              if ((evt instanceof ControllerClosedEvent) ||(evt instanceof ControllerErrorEvent) ||(evt instanceof DeallocateEvent))
                   Player p = (Player)evt.getSourceController();
                        if (!terminatedbyClose)
                             if (playerlist.contains(p))
                                  playerlist.removeElement(p);
                             if ((playerlist.size() == 0) && (mgr != null))
                                  mgr.dispose();
                             }//edn of if
                   }//end of if
         }//end of controllerupdate
         public void closeManager()
              terminatedbyClose = true;
              // first close all the players
              for (int i = 0; i < playerlist.size(); i++)
                   ((Player)playerlist.elementAt(i)).close();
              if (mgr != null)
                   mgr.dispose();     
                   mgr = null;
         }//end of closeManager
         class RTPPlayerWindow extends PlayerWindow
                   public RTPPlayerWindow(Player player, String title)
                        super(player);
                        setTitle(title);
                   public void Name(String title)
                        setTitle(title);
              }// end of PlayerWindow
    public static void main(String args[])
    client cl=new client();
    }//END OF MAIN
    }//end of client

    hi there
    as far as i can see, you don't start the processor
    that provides the datasource to the manager, before
    starting the sendstream.
    rtpMgrs.initialize(localAddr);
    rtpMgrs.addTarget(destAddr);
    System.out.println( "Created RTP session: ");
    sendStream = rtpMgrs.createSendStream(dataOut, i);
    System.out.println("stream send created");p.start();
    sendStream.start();
    System.out.println("sendstream started")

  • Rtp video streaming issue from linux to windows

    i am currently running a windows machine and linux machine on the same network connected by a linksy wrt45g router. i am trying to use avtransmit2.java and avreceive2.java to stream a video from one computer to the other and i can't get it to go from either win to linux or linux to win.
    i am able to send information from one computer to the other through an objectoutputstream, but i have been unsuccessful in getting video to go through rtp from one computer to the other.
    anyone have any ideas? it is starting to get really frustrating. i have been able to do something similar using vlc, but the avreceive and avtransmit won't work. i am using a new configuration, and have been successfull with the same code previous times
    thanks
    bd

    You can use MediaPlayerLauncher or MediaElement control
    https://msdn.microsoft.com/en-us/library/windows/apps/hh394004%28v=vs.105%29.aspx
    https://msdn.microsoft.com/en-us/library/windows/apps/ff769551(v=vs.105).aspx
    Gaurav Khanna | Microsoft .NET MVP | Microsoft Community Contributor

  • JMF RTP and Linux/Fedora Core3

    Hello,
    I am attempting to use JMF 2.1.1e with Linux/Fedora Core3, and see an exception as:
    java.io.IOException: Can't open local data port: 51450
    at com.sun.media.datasink.rtp.Handler.open(Handler.java:141)
    Debugging more, I can see the Handler.open fails when it is trying to
    rtpmanager.initialize(localaddr);
    where localaddr is "SessionAddress()" (no args to the constructor).
    I am unable to debug beyond this. Any help?
    Best regards,
    -Arun.

    More debugging, but still at a block:
    It seems: com.sun.media.rtp.RTPSessionMgr is instantiated as the rtpmanager.
    There is no source for this and so cannot figure out why this fails.
    Best regards,
    -Arun.

  • JMF How to stream rtp from udp packet

    I implemented an rtsp client and use the client to setup two rtp session(audio, vedio). But when I use the example pramgram "AVReceive3" to stream the udp packet, it doesn't work.
    When the AVReceive3 receive the udp packet from the rtp port, it will call the update(ReceiveStreamEvent evt) function, and the event type is StreamMappedEvent, and the call to evt.getReceiveStream().getDataSource() return null.
    I thought the first event should be NewReceiveStreamEvent. Please help to solve the problem.
    What's rtp packet will cause the event StreamMappedEvent.
    Following is the code of AVReceive3.java:
    * AVReceive3.java
    * Created on 2007&#24180;10&#26376;30&#26085;, &#19979;&#21320;4:11
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package PlayerTest;
    import java.io.*;
    import java.awt.*;
    import java.net.*;
    import java.awt.event.*;
    import java.util.Vector;
    import javax.media.*;
    import javax.media.rtp.*;
    import javax.media.rtp.event.*;
    import javax.media.rtp.rtcp.*;
    import javax.media.protocol.*;
    import javax.media.protocol.DataSource;
    import javax.media.format.AudioFormat;
    import javax.media.format.VideoFormat;
    import javax.media.Format;
    import javax.media.format.FormatChangeEvent;
    import javax.media.control.BufferControl;
    * AVReceive3 to receive RTP transmission using the RTPConnector.
    public class AVReceive3 extends Thread implements ReceiveStreamListener, SessionListener,
    ControllerListener
    String sessions[] = null;
    RTPManager mgrs[] = null;
    Vector playerWindows = null;
    boolean dataReceived = false;
    Object dataSync = new Object();
    public AVReceive3(String sessions[])
    this.sessions = sessions;
    public void run()
    initialize();
    public boolean initialize() {
    try {
    mgrs = new RTPManager[sessions.length];
    playerWindows = new Vector();
    SessionLabel session;
    // Open the RTP sessions.
    for (int i = 0; i < sessions.length; i++) {
    // Parse the session addresses.
    try {
    session = new SessionLabel(sessions);
    } catch (IllegalArgumentException e) {
    System.err.println("Failed to parse the session address given: " + sessions[i]);
    return false;
    System.err.println(" - Open RTP session for: addr: " + session.addr + " port: " + session.port + " ttl: " + session.ttl);
    mgrs[i] = (RTPManager) RTPManager.newInstance();
    mgrs[i].addSessionListener(this);
    mgrs[i].addReceiveStreamListener(this);
    // Initialize the RTPManager with the RTPSocketAdapter
    mgrs[i].initialize(new RTPSocketAdapter(
    InetAddress.getByName(session.addr),
    session.port, session.ttl));
    // You can try out some other buffer size to see
    // if you can get better smoothness.
    BufferControl bc = (BufferControl)mgrs[i].getControl("javax.media.control.BufferControl");
    if (bc != null)
    bc.setBufferLength(350);
    } catch (Exception e){
    System.err.println("Cannot create the RTP Session: " + e.getMessage());
    return false;
    // Wait for data to arrive before moving on.
    long then = System.currentTimeMillis();
    long waitingPeriod = 30000; // wait for a maximum of 30 secs.
    try{
    synchronized (dataSync) {
    while (!dataReceived &&
    System.currentTimeMillis() - then < waitingPeriod) {
    if (!dataReceived)
    System.err.println(" - Waiting for RTP data to arrive");
    dataSync.wait(1000);
    } catch (Exception e) {}
    if (!dataReceived) {
    System.err.println("No RTP data was received.");
    close();
    return false;
    return true;
    public boolean isDone() {
    return playerWindows.size() == 0;
    * Close the players and the session managers.
    protected void close() {
    for (int i = 0; i < playerWindows.size(); i++) {
    try {
    ((PlayerWindow)playerWindows.elementAt(i)).close();
    } catch (Exception e) {}
    playerWindows.removeAllElements();
    // close the RTP session.
    for (int i = 0; i < mgrs.length; i++) {
    if (mgrs[i] != null) {
    mgrs[i].removeTargets( "Closing session from AVReceive3");
    mgrs[i].dispose();
    mgrs[i] = null;
    PlayerWindow find(Player p) {
    for (int i = 0; i < playerWindows.size(); i++) {
    PlayerWindow pw = (PlayerWindow)playerWindows.elementAt(i);
    if (pw.player == p)
    return pw;
    return null;
    PlayerWindow find(ReceiveStream strm) {
    for (int i = 0; i < playerWindows.size(); i++) {
    PlayerWindow pw = (PlayerWindow)playerWindows.elementAt(i);
    if (pw.stream == strm)
    return pw;
    return null;
    * SessionListener.
    public synchronized void update(SessionEvent evt) {
    if (evt instanceof NewParticipantEvent) {
    Participant p = ((NewParticipantEvent)evt).getParticipant();
    System.err.println(" - A new participant had just joined: " + p.getCNAME());
    * ReceiveStreamListener
    public synchronized void update( ReceiveStreamEvent evt) {
    System.out.println("\nReceive an receiveStreamEvent:"+evt.toString());
    RTPManager mgr = (RTPManager)evt.getSource();
    Participant participant = evt.getParticipant(); // could be null.
    ReceiveStream stream = evt.getReceiveStream(); // could be null.
    System.out.println("The RTPManager is:");
    if (evt instanceof RemotePayloadChangeEvent) {
    System.err.println(" - Received an RTP PayloadChangeEvent.");
    System.err.println("Sorry, cannot handle payload change.");
    System.exit(0);
    else if (evt instanceof NewReceiveStreamEvent) {
    try {
    stream = ((NewReceiveStreamEvent)evt).getReceiveStream();
    DataSource ds = stream.getDataSource();
    // Find out the formats.
    RTPControl ctl = (RTPControl)ds.getControl("javax.media.rtp.RTPControl");
    if (ctl != null){
    System.err.println(" - Recevied new RTP stream: " + ctl.getFormat());
    } else
    System.err.println(" - Recevied new RTP stream");
    if (participant == null)
    System.err.println(" The sender of this stream had yet to be identified.");
    else {
    System.err.println(" The stream comes from: " + participant.getCNAME());
    // create a player by passing datasource to the Media Manager
    Player p = javax.media.Manager.createPlayer(ds);
    if (p == null)
    return;
    p.addControllerListener(this);
    p.realize();
    PlayerWindow pw = new PlayerWindow(p, stream);
    playerWindows.addElement(pw);
    pw.setVisible(true);
    // Notify intialize() that a new stream had arrived.
    synchronized (dataSync) {
    dataReceived = true;
    dataSync.notifyAll();
    } catch (Exception e) {
    System.err.println("NewReceiveStreamEvent exception " + e.getMessage());
    return;
    else if (evt instanceof StreamMappedEvent) {
    if (stream != null)
    if(stream.getDataSource()!=null)
    DataSource ds = stream.getDataSource();
    // Find out the formats.
    RTPControl ctl = (RTPControl)ds.getControl("javax.media.rtp.RTPControl");
    System.err.println(" - The previously unidentified stream ");
    if (ctl != null)
    System.err.println(" " + ctl.getFormat());
    System.err.println(" had now been identified as sent by: " + participant.getCNAME());
    else if (evt instanceof ByeEvent) {
    System.err.println(" - Got \"bye\" from: " + participant.getCNAME());
    PlayerWindow pw = find(stream);
    if (pw != null) {
    pw.close();
    playerWindows.removeElement(pw);
    * ControllerListener for the Players.
    public synchronized void controllerUpdate(ControllerEvent ce) {
    Player p = (Player)ce.getSourceController();
    if (p == null)
    return;
    // Get this when the internal players are realized.
    if (ce instanceof RealizeCompleteEvent) {
    PlayerWindow pw = find(p);
    if (pw == null) {
    // Some strange happened.
    System.err.println("Internal error!");
    System.exit(-1);
    pw.initialize();
    pw.setVisible(true);
    p.start();
    if (ce instanceof ControllerErrorEvent) {
    p.removeControllerListener(this);
    PlayerWindow pw = find(p);
    if (pw != null) {
    pw.close();
    playerWindows.removeElement(pw);
    System.err.println("AVReceive3 internal error: " + ce);
    * A utility class to parse the session addresses.
    class SessionLabel {
    public String addr = null;
    public int port;
    public int ttl = 1;
    SessionLabel(String session) throws IllegalArgumentException {
    int off;
    String portStr = null, ttlStr = null;
    if (session != null && session.length() > 0) {
    while (session.length() > 1 && session.charAt(0) == '/')
    session = session.substring(1);
    // Now see if there's a addr specified.
    off = session.indexOf('/');
    if (off == -1) {
    if (!session.equals(""))
    addr = session;
    } else {
    addr = session.substring(0, off);
    session = session.substring(off + 1);
    // Now see if there's a port specified
    off = session.indexOf('/');
    if (off == -1) {
    if (!session.equals(""))
    portStr = session;
    } else {
    portStr = session.substring(0, off);
    session = session.substring(off + 1);
    // Now see if there's a ttl specified
    off = session.indexOf('/');
    if (off == -1) {
    if (!session.equals(""))
    ttlStr = session;
    } else {
    ttlStr = session.substring(0, off);
    if (addr == null)
    throw new IllegalArgumentException();
    if (portStr != null) {
    try {
    Integer integer = Integer.valueOf(portStr);
    if (integer != null)
    port = integer.intValue();
    } catch (Throwable t) {
    throw new IllegalArgumentException();
    } else
    throw new IllegalArgumentException();
    if (ttlStr != null) {
    try {
    Integer integer = Integer.valueOf(ttlStr);
    if (integer != null)
    ttl = integer.intValue();
    } catch (Throwable t) {
    throw new IllegalArgumentException();
    * GUI classes for the Player.
    class PlayerWindow extends Frame {
    Player player;
    ReceiveStream stream;
    PlayerWindow(Player p, ReceiveStream strm) {
    player = p;
    stream = strm;
    public void initialize() {
    add(new PlayerPanel(player));
    public void close() {
    player.close();
    setVisible(false);
    dispose();
    public void addNotify() {
    super.addNotify();
    pack();
    * GUI classes for the Player.
    class PlayerPanel extends Panel {
    Component vc, cc;
    PlayerPanel(Player p) {
    setLayout(new BorderLayout());
    if ((vc = p.getVisualComponent()) != null)
    add("Center", vc);
    if ((cc = p.getControlPanelComponent()) != null)
    add("South", cc);
    public Dimension getPreferredSize() {
    int w = 0, h = 0;
    if (vc != null) {
    Dimension size = vc.getPreferredSize();
    w = size.width;
    h = size.height;
    if (cc != null) {
    Dimension size = cc.getPreferredSize();
    if (w == 0)
    w = size.width;
    h += size.height;
    if (w < 160)
    w = 160;
    return new Dimension(w, h);
    public static void main(String argv[]) {
    //if (argv.length == 0)
    // prUsage();
    String sessions[]= new String[] {"127.0.0.1/6670","127.0.0.1/6672"};
    AVReceive3 avReceive = new AVReceive3(sessions);
    if (!avReceive.initialize()) {
    System.err.println("Failed to initialize the sessions.");
    System.exit(-1);
    // Check to see if AVReceive3 is done.
    try {
    while (!avReceive.isDone())
    Thread.sleep(1000);
    } catch (Exception e) {}
    System.err.println("Exiting AVReceive3");
    static void prUsage() {
    System.err.println("Usage: AVReceive3 <session> <session> ");
    System.err.println(" <session>: <address>/<port>/<ttl>");
    System.exit(0);
    }// end of AVReceive3
    Following is the code of RTPSocketAdapter.java:
    * RTPSocketAdapter.java
    * Created on 2007&#24180;10&#26376;30&#26085;, &#19979;&#21320;4:13
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package PlayerTest;
    import java.io.IOException;
    import java.net.InetAddress;
    import java.net.DatagramSocket;
    import java.net.MulticastSocket;
    import java.net.DatagramPacket;
    import java.net.SocketException;
    import javax.media.protocol.DataSource;
    import javax.media.protocol.PushSourceStream;
    import javax.media.protocol.ContentDescriptor;
    import javax.media.protocol.SourceTransferHandler;
    import javax.media.rtp.RTPConnector;
    import javax.media.rtp.OutputDataStream;
    * An implementation of RTPConnector based on UDP sockets.
    public class RTPSocketAdapter implements RTPConnector {
    DatagramSocket dataSock;
    DatagramSocket ctrlSock;
    InetAddress addr;
    int port;
    SockInputStream dataInStrm = null;
    SockInputStream ctrlInStrm = null;
    SockOutputStream dataOutStrm = null;
    SockOutputStream ctrlOutStrm = null;
    public RTPSocketAdapter(InetAddress addr, int port) throws IOException {
    this(addr, port, 1);
    public RTPSocketAdapter(InetAddress addr, int port, int ttl) throws IOException {
    try {
    if (addr.isMulticastAddress()) {
    dataSock = new MulticastSocket(port);
    ctrlSock = new MulticastSocket(port+1);
    ((MulticastSocket)dataSock).joinGroup(addr);
    ((MulticastSocket)dataSock).setTimeToLive(ttl);
    ((MulticastSocket)ctrlSock).joinGroup(addr);
    ((MulticastSocket)ctrlSock).setTimeToLive(ttl);
    } else {
    dataSock = new DatagramSocket(port, InetAddress.getLocalHost());
    ctrlSock = new DatagramSocket(port+1, InetAddress.getLocalHost());
    } catch (SocketException e) {
    throw new IOException(e.getMessage());
    this.addr = addr;
    this.port = port;
    * Returns an input stream to receive the RTP data.
    public PushSourceStream getDataInputStream() throws IOException {
    if (dataInStrm == null) {
    dataInStrm = new SockInputStream(dataSock, addr, port);
    dataInStrm.start();
    return dataInStrm;
    * Returns an output stream to send the RTP data.
    public OutputDataStream getDataOutputStream() throws IOException {
    if (dataOutStrm == null)
    dataOutStrm = new SockOutputStream(dataSock, addr, port);
    return dataOutStrm;
    * Returns an input stream to receive the RTCP data.
    public PushSourceStream getControlInputStream() throws IOException {
    if (ctrlInStrm == null) {
    ctrlInStrm = new SockInputStream(ctrlSock, addr, port+1);
    ctrlInStrm.start();
    return ctrlInStrm;
    * Returns an output stream to send the RTCP data.
    public OutputDataStream getControlOutputStream() throws IOException {
    if (ctrlOutStrm == null)
    ctrlOutStrm = new SockOutputStream(ctrlSock, addr, port+1);
    return ctrlOutStrm;
    * Close all the RTP, RTCP streams.
    public void close() {
    if (dataInStrm != null)
    dataInStrm.kill();
    if (ctrlInStrm != null)
    ctrlInStrm.kill();
    dataSock.close();
    ctrlSock.close();
    * Set the receive buffer size of the RTP data channel.
    * This is only a hint to the implementation. The actual implementation
    * may not be able to do anything to this.
    public void setReceiveBufferSize( int size) throws IOException {
    dataSock.setReceiveBufferSize(size);
    * Get the receive buffer size set on the RTP data channel.
    * Return -1 if the receive buffer size is not applicable for
    * the implementation.
    public int getReceiveBufferSize() {
    try {
    return dataSock.getReceiveBufferSize();
    } catch (Exception e) {
    return -1;
    * Set the send buffer size of the RTP data channel.
    * This is only a hint to the implementation. The actual implementation
    * may not be able to do anything to this.
    public void setSendBufferSize( int size) throws IOException {
    dataSock.setSendBufferSize(size);
    * Get the send buffer size set on the RTP data channel.
    * Return -1 if the send buffer size is not applicable for
    * the implementation.
    public int getSendBufferSize() {
    try {
    return dataSock.getSendBufferSize();
    } catch (Exception e) {
    return -1;
    * Return the RTCP bandwidth fraction. This value is used to
    * initialize the RTPManager. Check RTPManager for more detauls.
    * Return -1 to use the default values.
    public double getRTCPBandwidthFraction() {
    return -1;
    * Return the RTCP sender bandwidth fraction. This value is used to
    * initialize the RTPManager. Check RTPManager for more detauls.
    * Return -1 to use the default values.
    public double getRTCPSenderBandwidthFraction() {
    return -1;
    * An inner class to implement an OutputDataStream based on UDP sockets.
    class SockOutputStream implements OutputDataStream {
    DatagramSocket sock;
    InetAddress addr;
    int port;
    public SockOutputStream(DatagramSocket sock, InetAddress addr, int port) {
    this.sock = sock;
    this.addr = addr;
    this.port = port;
    public int write(byte data[], int offset, int len) {
    try {
    sock.send(new DatagramPacket(data, offset, len, addr, port));
    } catch (Exception e) {
    return -1;
    return len;
    * An inner class to implement an PushSourceStream based on UDP sockets.
    class SockInputStream extends Thread implements PushSourceStream {
    DatagramSocket sock;
    InetAddress addr;
    int port;
    boolean done = false;
    boolean dataRead = false;
    SourceTransferHandler sth = null;
    public SockInputStream(DatagramSocket sock, InetAddress addr, int port) {
    this.sock = sock;
    this.addr = addr;
    this.port = port;
    public int read(byte buffer[], int offset, int length) {
    DatagramPacket p = new DatagramPacket(buffer, offset, length, addr, port);
    try {
    sock.receive(p);
    } catch (IOException e) {
    return -1;
    synchronized (this) {
    dataRead = true;
    notify();
    System.out.println("RTPSocketAdapter receive RTP packet from port:"+port);
    System.out.println("The received RTP packet:"+new String(buffer));
    return p.getLength();
    public synchronized void start() {
    super.start();
    if (sth != null) {
    dataRead = true;
    notify();
    public synchronized void kill() {
    done = true;
    notify();
    public int getMinimumTransferSize() {
    return 2 * 1024; // twice the MTU size, just to be safe.
    public synchronized void setTransferHandler(SourceTransferHandler sth) {
    this.sth = sth;
    dataRead = true;
    notify();
    // Not applicable.
    public ContentDescriptor getContentDescriptor() {
    return null;
    // Not applicable.
    public long getContentLength() {
    return LENGTH_UNKNOWN;
    // Not applicable.
    public boolean endOfStream() {
    return false;
    // Not applicable.
    public Object[] getControls() {
    return new Object[0];
    // Not applicable.
    public Object getControl(String type) {
    return null;
    * Loop and notify the transfer handler of new data.
    public void run() {
    while (!done) {
    synchronized (this) {
    while (!dataRead && !done) {
    try {
    wait();
    } catch (InterruptedException e) { }
    dataRead = false;
    if (sth != null && !done) {
    sth.transferData(this);
    Thanks.

    The error of No format has been registered for RTP Payload type 96
    is caused by the dynamic payload mapping, when I add the dynamic mapping between dynamic payload and format. The Player cann't work yet. I think it because JMF doesn't support the format of my clips. For example:
    video: a=rtpmap:96 H263-2000/90000
    audio:a=rtpmap:97 MP4A-LATM/12000/1
    Is there some available plugin to support these format?
    Thanks

  • Receiveing data over RTP doesn't work

    First of all , excuse my english.....it really sucks
    Second of all , this is my problem:
    I modified the JMStudio source to suit my needs.....leaving just what i needed.The application works......it sends data just fine but it does't receives it.I tried to rewrite the function thousand of times in different modes but it doesn't work.
    This is my source code :
              private void openRtp () {
    OpenRtpDialog dlgOpenRtp;
    String strAction;
    String strAddress;
    String strPort;
    String strTtl;
    RTPManager           receptie=RTPManager.newInstance();
    InetAddress      adresaip=null;
    int                    port,ttl;
    ReceiveStreamListener receptiestr = null;
    ReceiveStreamEvent     x = null;
    dlgOpenRtp = new OpenRtpDialog ( this, cfgJMApps );
         dlgOpenRtp.isVisible ();
    strAction = dlgOpenRtp.getAction ();
    if ( !strAction.equals(JMDialog.ACTION_OPEN) )
    return;
    strAddress = dlgOpenRtp.getAddress();
    strPort = dlgOpenRtp.getPort ();
    strTtl = dlgOpenRtp.getTtl ();
                   try {
                        adresaip=InetAddress.getByName(strAddress);
                   } catch (UnknownHostException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
    port=Integer.valueOf(strPort).intValue();
    ttl=Integer.valueOf(strTtl).intValue();
    SessionAddress adresa=new SessionAddress(adresaip,port,ttl);
         try {
                        receptie.initialize(adresa);
                   } catch (InvalidSessionAddressException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                   } catch (IOException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
    if ( receptie == null ) {
    MessageDialog.createErrorDialog ( this, JMFI18N.getResource("jmstudio.error.sessionmngr.create") );
    return;
    receptie.addReceiveStreamListener(receptiestr);
    receptiestr.update(x);
    update(x);
    // the rest will be done when we get NewReceiveStreamEvent
    updateMenu ();
    pls tell me what i do wrong cause it's driving me insane......the function from the JMStudio works in the original but doesn't work in my version so it makes me think that the problem is from somewhere else.
    For further assistance i'll be watching this thread closely.
    Thank you for your help.
    Yours gratefully,
    Sorin

    I'm just going to point you in the direction of some sample code...
    [http://java.sun.com/javase/technologies/desktop/media/jmf/2.1.1/solutions/AVReceive.html]
    Go look at their "initialize" function and figure out what the sample code is doing that you aren't...
    And remember, it could simply be a matter of doing something wrong with IP address... You can't use 127.0.0.1 for RTP transmissions, and you can't broadcast to the same computer if your transmit code is binding the destination port as the transmission port. IE, if you tell it to broadcast to the remote computer on port 2600, and it uses the local port 2600 to broadcast on...then you won't be able to read from port 2600 on the local computer.

  • Audio transmit problem under redhat linux 9

    Hi !!
    I have already compiled J2sdk1.4.2 and JMF2.1.1e performance pack for linux and they both work alright under Redhat linux 9. JMStudio works fine to playback audio files. The problem I'm having is when I try to transmit and receive audio files through AVTransmit2, AVReceive2 and JMStudio!! They just don't work!!
    AVTransmit2 and JMStudio just starts to transmit but on the receiving end both jmstudio and avreceiver2 just waits for rtp data but none arrives!!
    Can anyone help me with this problem?? I've already tried spending a whole day cranking my brain about this!!
    Thanks in advance

    make sure your hostname is somehostname.com , and make sure you have your IP mapped to your hostname in /etc/hosts file.

Maybe you are looking for

  • Are any iBooks Author books coming out?

    We all hear about the seemingly difficult process of getting an iBooks Author book through Apple's gates. It would be nice to see what is emerging as finally published books. We've seen a few mentioned here but where are the new titles coming out thi

  • XREF in WebHelp TOC Output

    I am using the Technical Communication Suite and I imported FrameMaker books in to RoboHelp HTML. After I autocreated the TOC, and then generated the primary layout, there are many cross reference items appearing as topics in the Contents pane, for e

  • Which is a better IDE?

    Hi, Please give me your suggestions on which is a better IDE amongst Sun One Studio and JBuilder SE? How is NetBeans? Thanks in advance, npaila

  • Metadata term store update

    I have some sites and documents that uses various items from the Term Store  Nov I've changed some of the terms - e.g... Contoso to Contosi - but this is not reflecting on the documents/sites..  It only shows a red contoso when I open the document th

  • Blue Moon: The Ring Of Mer

    In a time when myths and legends are thought to be fairy tales, young Cora finds herself thrown into a world of ancient legends and prophecy. Cora's own life is in danger. From the sea, mystery and lore will be born. He is of a land deep below the wa