Android live streaming – h264 decoding

androidffmpeggstreamerlive-streamingrtsp

Since i'm a little familiar with android and video streaming, i know it's complicated to handle live video streams from device to device.

Requirement: play incoming raw h264 stream

Are there any ways beside serving rtp/rtsp to playback the stream?
VideoView needs local rtsp or http server to handle the stream and i cannot believe, that there are no other ways to simply play it.

Could be GStreamer / FFMpeg a good solution to decode the stream?

Best Answer

For this purpose, you can use the new MediaCodec API introduced in Jelly Bean.

All you have to do is set a surface when configuring, e.g.

mDecoder.configure(mFormat, surfaceHolder.getSurface(), null, 0);

Then, when you release the output buffer, just tell the decoder to show the frame on the surface, e.g.

mDecoder.releaseOutputBuffer(decoderIndex, true);

If you need to get comfortable with the MediaCodec API, this tutorial was a good start for me: http://dpsm.wordpress.com/2012/07/28/android-mediacodec-decoded/