【问题标题】:Sending RTP packages on the same port as RTSP在与 RTSP 相同的端口上发送 RTP 包
【发布时间】:2012-12-20 00:35:06
【问题描述】:

我有点困惑,希望你能帮助我。我正在我的 Android 上编写 rtsp 服务器。我遇到了一些问题,但除了一个之外,还有一些方法可以解决所有问题。

说明: 我的应用程序由 3 个模块 RTSP、RTP 和 UI 组成。 跳过 UI 的描述。 RTSP 开始监听 tcp 端口 55555。然后在 VLC 中输入 rtsp://address: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 相同的端口上发送流吗?我指望您的帮助,因为有很多代码需要更改。

请原谅我的英语。

【问题讨论】:

  • RTP 和 RTSP 端口可以而且必须不同,这没有错。你如何发送/接收流?请粘贴一些代码。
  • "live555 warning: no data received in 10s. Switching to TCP" 这一行是日志告诉 vlc 没有收到 UDP 数据。你能检查一下UDP端口是否打开。还要检查服务器生成的 SDP 响应,SDP 中的端口应与您传输数据的端口相同。
  • 在通过 RTSP 协商期间,我的服务器和 vlc 客户端设置了 trasport 端口和服务器端口,所以我认为 vlc 端口是开放的。顺便说一句,连接是在我的局域网中设置的,没有防火墙问题。另一方面,我将 SDP 作为内容发送。我认为这是正确的,因为最终建立了联系。你能告诉我我究竟要在 SDP 内容中添加什么吗?

标签: android rtsp vlc rtp


【解决方案1】:

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

【讨论】:

  • 是的,所以告诉我为什么当数据将在同一个(当前)连接中发送时,我需要协商发送数据连接的端口和类型(udp/tcp)?
猜你喜欢
  • 2013-04-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-11-09
  • 1970-01-01
  • 2015-03-07
  • 2013-11-14
  • 1970-01-01
相关资源
最近更新 更多