I'm trying to decode a raw h264 stream on "older" Android versions. I've tried MediaPlayer class and does not seem to support the stream format.
I can see the stream on other Cam Viewer apps from the market, so I figure there must be a way to do it, probably using the NDK.
I've read about OpenMAX and Stagefright, but couldn't find a working example about streaming.
Could someone please point me in the right direction?
Also, I'm reading in several places about "frameworks/av/include/media/stagefright/MediaSource.h" and other sources, but they don't seem to be either in the regular SDK or the NDK. Where is this source located? is there another sdk?
Thanks in advance.
Update: I'm receiving a rtsp connection.
If you wish to perform only a simple experiment to verify certain functionality, you can consider employing the command line
stagefright
utility. Please do consider this condition where your streaming input may not be supported.If you wish to build a more comprehensive player pipeline, you can consider the handling for
rtsp
as in here orhttp
as in here. Please note thatNuCachedSource2
implementation is essential for streaming input as this provides apage cache
implementation which acts as a jitter for the streaming data.Please do note one critical point: Command line
stagefright
utility doesn't render to the screen. Hence, if you wish to render, you will to implement the complete playback pipeline with rendering.On a related note, if your input is
streaming input
, the standard player implementation does have support for streaming inputs as can be observed here. Did you face any issues with the same?As fadden has already pointed out, your work is made far more simpler with the introduction of
MediaCodec
inAndroid 4.x
.