How to use MediaCodec to decode data from RTSP server?

社会主义新天地 提交于 2019-12-21 15:04:58

问题


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.

Is there a relatively easy way of feeding video stream from RTSP server into MediaCodec class?


回答1:


No easy way. I ended up using this project:

https://code.google.com/p/android-rtsp-client/

for RTSP protocol (worked after some fixes and modifications).

I needed to implement RTP and RTCP protocols myself (some simplified versions were enough in my case).

I also needed to create a code for extracting NAL units from RTP packets. I had to read this first:

http://www.ietf.org/rfc/rfc3984.txt

to figure out how to do that.



来源:https://stackoverflow.com/questions/17994837/how-to-use-mediacodec-to-decode-data-from-rtsp-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!