如何使用MediaCodec解码RTSP服务器中的数据? [英] How to use MediaCodec to decode data from RTSP server?
问题描述
我在MediaExtractor
类中尝试了setDataSource()
,但不适用于RTSP路径.我可以对MediaPlayer
类使用相同的路径,并且可以使用,但是对我来说,使用MediaCodec
类非常重要.我认为Android没有我可以使用的任何RTSP API,也找不到任何适用于Android的RTSP库.
I tried setDataSource()
in MediaExtractor
class but it doesn't work with RTSP path. I can use the same path with MediaPlayer
class and it works but it is very important for me to use MediaCodec
class instead. I think Android doesn't have any RTSP API I could use nor I can find any RTSP libraries for Android.
从RTSP服务器向MediaCodec
类馈送视频流是否有相对简单的方法?
Is there a relatively easy way of feeding video stream from RTSP server into MediaCodec
class?
推荐答案
没有简单的方法.我最终使用了这个项目:
No easy way. I ended up using this project:
用于RTSP协议(经过一些修复和修改后可以使用.)
for RTSP protocol (worked after some fixes and modifications).
我需要自己实现RTP和RTCP协议(对于我来说,一些简化版本就足够了.)
I needed to implement RTP and RTCP protocols myself (some simplified versions were enough in my case).
我还需要创建一个代码以从RTP数据包中提取NAL单元.我必须先阅读以下内容:
I also needed to create a code for extracting NAL units from RTP packets. I had to read this first:
弄清楚该怎么做.
这篇关于如何使用MediaCodec解码RTSP服务器中的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!