RTSP协议栈的实现
我正在努力使 RTSP url 在 Android 上工作。
我已经使用
MediaPlayer
和VideoView
来播放 RTSP url,但它们都无法在 G1 设备和模拟器中播放。 错误是PVMFFailureiin PLAYER_INIT
。所以我想到从头开始实现一个RTSP客户端。 我开发了一个小应用程序,它交换所有消息(描述、设置、播放、拆卸)。 但问题是在 PLAY 之后,我应该在 client_port 接收 RTP 数据包,如传输标头中所述,但 TCP 转储显示以下消息。 我认为 UDP 数据包即将到来,但应用程序未收到。
11:38:50.213394 IP ew-in-f177.google.com.6970> 192.168.1.2.6970:UDP,长度444 11:38:50.213451 IP 192.168.1.2> ew-in-f177.google.com:ICMP 192.168.1.2 udp 端口 6970 无法访问,长度 36
请让我知道如何解决此问题。
I am working on making RTSP url to work on Android.
I have used
MediaPlayer
andVideoView
to play the RTSP url but both of them fail to play in G1 Device and emulator. Error isPVMFFailureiin PLAYER_INIT
.So I thought of implementing a RTSP client from scratch. I have developed a small application, it exchanges all the messages (DESCRIBE, SETUP, PLAY, TEARDOWN). But the problem is after PLAY, I should receive the RTP packets at client_port as mentioned in Transport header but TCP dump shows the following messages. I think UDP packets are coming but not received at the application.
11:38:50.213394 IP ew-in-f177.google.com.6970 > 192.168.1.2.6970: UDP, length 444
11:38:50.213451 IP 192.168.1.2 > ew-in-f177.google.com: ICMP 192.168.1.2 udp port 6970 unreachable, length 36
Please let me know how to solve this issue.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
OpenCORE,Android 中的多媒体引擎,对于遵守各种标准相当严格。 一些可能在野外工作的东西(例如,基于 RTSP 的 MP3)不受支持,因为它们不在各自的规范中。 至少,这就是我们被告知的。
因此,您尝试流式传输的媒体可能稍微超出规格,或者服务器稍微超出规格。 您可能希望尝试找到一些已知可在 Android 上运行的 RTSP 流,让您的播放器正确使用它,然后专注于让它使用您自己的流。
OpenCORE, the multimedia engine in Android, is rather stringent about sticking to various standards. Some things that may work in the wild (e.g., MP3 over RTSP) are not supported because they are not in the respective spec. Leastways, that's what we have been told.
Hence, it may be that the media you are trying to stream is slightly out of spec, or the server is slightly out of spec. You may wish to try to find some RTSP stream known to work on Android, get your player working right using it, then focus on getting it to consume your own streams.
某些手机(我不知道 Android 是否属于此类)在设备上包含防火墙。 为了接收数据包,您可能必须执行打洞(即向服务器发送一个虚拟数据包)。这将在本地设备上运行的防火墙上创建允许规则。如果需要,它还将创建适当的 NAT 映射.)
设备是否在 WIFI 上或在运营商的网络(哪个运营商)上?
Some handsets (I don't know whether Android falls in this category or not) include a firewall on the device. In order to receive packets you may have to perform a hole punch (i.e. send a dummy packet to the server. This will create an allow rule on a firewall running on the local device. It will also create the appropriate NAT mapping if necessary as well.)
Is the device on WIFI or on the carrier's network (which carrier)?