javajmffmj

Problems creating an RTP stream with JMF


I'm at the very early stages of a project requiring the broadcasting, using RTP, of a DataStream created from a MediaLocation. I'm following some example code which currently failingin on the rptManager.initalize(localAddress) with the error "Can't open local data port: xxxx", specifically:

Exception in thread "main" javax.media.rtp.InvalidSessionAddressException: Can't open local data port: 34586
at com.sun.media.rtp.RTPSessionMgr.initialize(RTPSessionMgr.java:2688)
at com.sun.media.rtp.RTPSessionMgr.initialize(RTPSessionMgr.java:2515)
at RTPBroadcast.main(RTPBroadcast.java:20)

I'm developing on Lucid and my firewall is completely disabled. I'm a little stumped to be honest. My code is as follows:

// http://jcs.mobile-utopia.com/jcs/26201_RTPManager.java
public class RTPBroadcast { 
    public static void main (String[] args) throws InvalidSessionAddressException, IOException, UnsupportedFormatException {

        RTPManager rtpManager = RTPManager.newInstance();
        SessionAddress localAddress = new SessionAddress();

        rtpManager.initialize(localAddress);

        InetAddress ipAddress = InetAddress.getByName("192.168.1.5");

        SessionAddress remoteAddress = new SessionAddress(ipAddress, 3000);

        rtpManager.addTarget(remoteAddress);

        DataSource dataOutput = new ScreenSource();

        SendStream sendStream = rtpManager.createSendStream( dataOutput, 1);
        sendStream.start();
    }
}

Any ideas on what could be causing the problem?


Solution

  • If your problem currently isn't solved, try to look at jlibrtp instead of jmf.