[英]How to use MediaCodec to decode data from RTSP server?
I tried setDataSource()
in MediaExtractor
class but it doesn't work with RTSP path. 我在
MediaExtractor
类中尝试了setDataSource()
,但它不适用于RTSP路径。 I can use the same path with MediaPlayer
class and it works but it is very important for me to use MediaCodec
class instead. 我可以使用与
MediaPlayer
类相同的路径并且它可以工作,但对我来说使用MediaCodec
类非常重要。 I think Android doesn't have any RTSP API I could use nor I can find any RTSP libraries for Android. 我认为Android没有我可以使用的任何RTSP API,也没有找到适用于Android的任何RTSP库。
Is there a relatively easy way of feeding video stream from RTSP server into MediaCodec
class? 是否有一种相对简单的方法将视频流从RTSP服务器馈送到
MediaCodec
类?
No easy way. 没有简单的方法。 I ended up using this project:
我最终使用了这个项目:
https://code.google.com/p/android-rtsp-client/
https://code.google.com/p/android-rtsp-client/
for RTSP protocol (worked after some fixes and modifications). 对于RTSP协议(在一些修复和修改后工作)。
I needed to implement RTP and RTCP protocols myself (some simplified versions were enough in my case). 我自己需要实现RTP和RTCP协议(在我的情况下,一些简化版本就足够了)。
I also needed to create a code for extracting NAL units from RTP packets. 我还需要创建一个从RTP数据包中提取NAL单元的代码。 I had to read this first:
我必须先读这个:
http://www.ietf.org/rfc/rfc3984.txt
http://www.ietf.org/rfc/rfc3984.txt
to figure out how to do that. 弄清楚如何做到这一点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.