2012-07-26 144 views
1

我知道類似的問題已被問到,但我一直無法找到我的具體問題的答案。從Android流媒體到VLC

我正在嘗試創建從Android攝像機到VLC播放器客戶端的RTSP/RTP視頻流。我寫了一個小型RTSP服務器來處理所有的設置,而VLC似乎喜歡我的參數。但是,PLAY命令發出後,我的應用程序開始發送視頻流(通過DatagramPackets),VLC播放器不會收到任何數據。

我使用jlibrtp庫和設置我流像這樣

sendSoc = new DatagramSocket(1238); 
    recSoc = new DatagramSocket(1239); 
    sess = new RTPSession(sendSoc, recSoc); 
    FakeClass fc = new FakeClass(); //This implements the RTPAppIntf but all the functions are empty 
    sess.RTPSessionRegister(fc, null, null); 
    sess.payloadType(96); 
    Participant p = new Participant("localhost",1236,1237); 
    sess.addParticipant(p); 

這是從VLC播放器

Opening connection to 192.168.1.221, port 1234... 
[0xb1003790] main art finder debug: no art finder module matching "any" could be loaded 
[0xb1003790] main art finder debug: TIMER module_need() : 6.331 ms - Total 6.331 ms/1 intvls (Avg 6.331 ms) 
[0x9f653e0] main playlist debug: art not found for rtsp://192.168.1.221:1234 
...remote connection opened 
Sending request: OPTIONS rtsp://192.168.1.221:1234 RTSP/1.0 
CSeq: 2 
User-Agent: LibVLC/2.0.1 (LIVE555 Streaming Media v2011.12.23) 


Received 76 new bytes of response data. 
Received a complete OPTIONS response: 
RTSP/1.0 200 OK 
CSeq: 2 
Public: DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE 


Sending request: DESCRIBE rtsp://192.168.1.221:1234 RTSP/1.0 
CSeq: 3 
User-Agent: LibVLC/2.0.1 (LIVE555 Streaming Media v2011.12.23) 
Accept: application/sdp 


Received 240 new bytes of response data. 
Received a complete DESCRIBE response: 
RTSP/1.0 200 OK 
CSeq: 3 
Content-Type: application/sdp 

v=0 
o=- 1343306778867 1343306778867 IN IP4 192.168.1.221 
s=Droid Stream 
i=Live Stream from Android Camera 
t=1343306778873 0 
m=video 1236/2 RTP/AVP 96 
a=rtpmap:96 H264/9000 


[0xb0101190] live555 demux debug: RTP subsession 'video/H264' 
Sending request: SETUP rtsp://192.168.1.221:1234/ RTSP/1.0 
CSeq: 4 
User-Agent: LibVLC/2.0.1 (LIVE555 Streaming Media v2011.12.23) 
Transport: RTP/AVP;unicast;client_port=1236-1237 


Received 128 new bytes of response data. 
Received a complete SETUP response: 
RTSP/1.0 200 OK 
CSeq: 4 
Session: 1343306779273 
Transport: RTP/AVP/UDP;unicast;client_port=1236-1237;server_port=1238-1239 


[0xb5203c18] main input debug: selecting program id=0 
[0xb0101190] live555 demux debug: setup start: 0.000000 stop:0.000000 
Sending request: PLAY rtsp://192.168.1.221:1234 RTSP/1.0 
CSeq: 5 
User-Agent: LibVLC/2.0.1 (LIVE555 Streaming Media v2011.12.23) 
Session: 1343306779273 
Range: npt=0.000- 


Received 71 new bytes of response data. 
Received a complete PLAY response: 
RTSP/1.0 200 OK 
CSeq: 5 
Session: 1343306779273 
Range: npt=0.000- 

我看到的日誌。 。 [剪枝] 。 。

[0xb5203c18] main input debug: `rtsp://192.168.1.221:1234' successfully opened 
[0xb0101190] live555 demux warning: no data received in 10s. Switching to TCP 
Sending request: TEARDOWN rtsp://192.168.1.221:1234 RTSP/1.0 
CSeq: 6 
User-Agent: LibVLC/2.0.1 (LIVE555 Streaming Media v2011.12.23) 
Session: 1343306779273 

所以我不知道什麼是錯的。 VLC應該在Android設備端口1236上收聽,但它沒有看到數據包,所以我不知道它在哪裏聽。可以告訴我,如果這看起來正確嗎?

回答

1

發現了問題,寫我的包到Android設備的端口1236,而不是客戶端設備端口1236。因此,在這種狀態

Transport: RTP/AVP/UDP;unicast;client_port=1236-1237;server_port=1238-1239 

是說明服務器安裝程序命令的傳輸參數(Android手機)將從服務器端口1238向客戶端設備端口1236發送RTP分組。同樣,RTCP通信將在服務器端口1239和客戶端設備端口1237之間發生。

0

難道你不試圖檢查會話嗎?它是否包含端口1236上的數據包?您的FakeClass是否可能包含必須將數據發送到VLC的功能?