使用JMF创建RTP流时出现问题

时间:2010-05-12 19:23:23

标签: java jmf fmj

我正处于项目的早期阶段,需要使用RTP广播从DataStream创建的MediaLocation。我正在关注一些示例代码,这些代码当前在rptManager.initalize(localAddress)上失败,并显示错误“无法打开本地数据端口:xxxx ”,特别是:

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)

我正在开发Lucid,我的防火墙已完全禁用。说实话,我有点难过。我的代码如下:

// 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();
    }
}

关于可能导致问题的任何想法?

1 个答案:

答案 0 :(得分:0)

如果您的问题目前尚未解决,请尝试查看jlibrtp而不是jmf。