代码之家  ›  专栏  ›  技术社区  ›  Nick

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

  •  2
  • Nick  · 技术社区  · 16 年前

    我正处于一个项目的早期阶段,这个项目要求使用RTP广播 DataStream 由A创建 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 回复  |  直到 15 年前
        1
  •  0
  •   Dmitry    16 年前

    如果您当前的问题没有解决,请尝试查看 jlibrtp 而不是JMF。

    推荐文章