2012-12-20 71 views
0

我有点困惑,希望你能帮助我。我在Android上编写rtsp服务器。我遇到了一些问题,但有一些方法可以解决所有问题,除了一个问题。发送与RTSP相同的端口上的RTP包

描述: 我有一个应用程序由3个模块RTSP,RTP和UI组成。 跳过UI的描述。 RTSP开始监听tcp端口55555.然后在VLC I中输入rtsp://地址:55555 然后是握手和头部的所有RTSP共享。 Durung共享头文件程序集通过RTP和Android应用程序设置接收和设置端口开始发送一些字节,但...

这里是问题: VLC中没有任何图像。所以我看着日志和:

main debug: resyncing on rtsp://192.168.1.143:55555 
main debug: rtsp://192.168.1.143:55555 is at 2 
main debug: starting playback of the new playlist item 
main debug: resyncing on rtsp://192.168.1.143:55555 
main debug: rtsp://192.168.1.143:55555 is at 2 
main debug: creating new input thread 
main debug: Creating an input for 'rtsp://192.168.1.143:55555' 
main debug: using timeshift granularity of 50 MiB, in path 'D:\Users\Adrian\AppData\Local\Temp' 
main debug: `rtsp://192.168.1.143:55555' gives access `rtsp' demux `' path `192.168.1.143:55555' 
main debug: creating demux: access='rtsp' demux='' location='192.168.1.143:55555' file='\\192.168.1.143:55555' 
main debug: looking for access_demux module: 1 candidate 
live555 debug: version 2012.09.13 
qt4 debug: IM: Setting an input 
live555 debug: RTP subsession 'video/JPEG' 
main debug: selecting program id=0 
live555 debug: setup start: 0.000000 stop:100.000000 
live555 debug: We have a timeout of 600 seconds 
live555 debug: spawned timeout thread 
live555 debug: play start: 0.000000 stop:100.000000 
main debug: using access_demux module "live555" 
main debug: TIMER module_need() : 155.608 ms - Total 155.608 ms/1 intvls (Avg 155.608 ms) 
main debug: looking for decoder module: 32 candidates 
avcodec debug: libavcodec already initialized 
avcodec debug: trying to use direct rendering 
avcodec debug: allowing 4 thread(s) for decoding 
avcodec debug: ffmpeg codec (Motion JPEG Video) started 
main debug: using decoder module "avcodec" 
main debug: TIMER module_need() : 1.511 ms - Total 1.511 ms/1 intvls (Avg 1.511 ms) 
main debug: looking for meta reader module: 2 candidates 
lua debug: Trying Lua scripts in D:\Users\Adrian\AppData\Roaming\vlc\lua\meta\reader 
lua debug: Trying Lua scripts in E:\VideoLAN\VLC\lua\meta\reader 
lua debug: Trying Lua playlist script E:\VideoLAN\VLC\lua\meta\reader\filename.luac 
main debug: no meta reader module matching "any" could be loaded 
main debug: TIMER module_need() : 1.981 ms - Total 1.981 ms/1 intvls (Avg 1.981 ms) 
main debug: `rtsp://192.168.1.143:55555' successfully opened 
live555 warning: no data received in 10s. Switching to TCP 
main debug: removing module "avcodec" 
avcodec debug: ffmpeg codec (Motion JPEG Video) stopped 
main debug: killing decoder fourcc `MJPG', 0 PES in FIFO 
main debug: Program doesn't contain anymore ES 
live555 debug: RTP subsession 'video/JPEG' 
main debug: looking for decoder module: 32 candidates 
avcodec debug: libavcodec already initialized 
avcodec debug: trying to use direct rendering 
avcodec debug: allowing 4 thread(s) for decoding 
avcodec debug: ffmpeg codec (Motion JPEG Video) started 
main debug: using decoder module "avcodec" 
main debug: TIMER module_need() : 1.352 ms - Total 1.352 ms/1 intvls (Avg 1.352 ms) 
live555 debug: setup start: 0.000000 stop:100.000000 
live555 debug: play start: 0.000000 stop:100.000000 
live555 error: no data received in 10s, aborting 
main debug: EOF reached 
main debug: finished input 
main debug: removing module "avcodec" 
avcodec debug: ffmpeg codec (Motion JPEG Video) stopped 
main debug: killing decoder fourcc `MJPG', 0 PES in FIFO 
main debug: removing module "live555" 
main debug: Program doesn't contain anymore ES 
main debug: dead input 
main debug: changing item without a request (current 2/3) 
main debug: nothing to play 
qt4 debug: IM: Deleting the input 
main debug: TIMER input launching for 'rtsp://192.168.1.143:55555' : 161.112 ms - Total 161.112 ms/1 intvls (Avg 161.112 ms) 
qt4 debug: Small 
qt4 debug: Saving the simple preferences 
main debug: opening config file (D:\Users\Adrian\AppData\Roaming\vlc\vlcrc) 

而我的问题:我必须发送与RTSP相同的端口上的流吗?我依靠你的帮助,因为有很多代码需要改变。

请原谅我的英语。

+0

RTP和RTSP端口可以而且必须是不同的,没有错。你如何发送/接收流?请粘贴一些代码。 – 1615903

+0

“live555警告:10秒内没有收到数据。切换到TCP”这一行是日志,告诉UDP数据没有被vlc接收。你可以检查UDP端口是否打开。还要检查服务器生成的SDP响应,SDP中的端口应与传输数据的端口相同。 – rajneesh

+0

通过RTSP协商我的服务器和vlc客户端设置trasport端口和服务器端口,所以我认为vlc端口是开放的。连接设置在我的局域网中,并且没有防火墙问题。 另一方面,我发送SDP作为内容。我认为这是正确的,因为最终建立连接。你能告诉我我到底需要投入SDP内容吗? – adrian

回答

0

流式视频没有通过udp到达VLC。 这就是为什么超时10秒后,它尝试回退并通过tcp接收媒体。 你可以看看rtp/rtsp/tcp。这是一种协议,允许在rtsp的相同套接字上发送rtp数据包。

+0

是的,那么告诉我为什么我需要协商端口和类型(udp/tcp)的发送数据连接时,数据将发送在同一(当前)连接呢? – adrian