2010-05-12 106 views
2

我處於項目的最初階段,需要使用RTP對從MediaLocation創建的DataStream進行廣播。我下面目前failingin的rptManager.initalize(localAddress)有錯誤一些示例代碼「無法打開本地數據端口:XXXX」,具體如下:使用JMF創建RTP流的問題

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) 

我在清醒的開發和我的防火牆是完全禁用。說實話,我有點難過。我的代碼如下:

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

關於可能導致問題的任何想法?

回答

0

如果您的問題目前尚未解決,請嘗試查看jlibrtp而不是jmf。