2
votes

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?

1
Have you looked at MediaCodec? I think it is only available on JellyBean btw.Pete
Yes, but the documentation of MediaCodec API is just bad, only few examples... is it possible to decode the raw h264 stream and play it directly via videoview?alex_muc
Doesn't look like the VideoView api offers a way of doing so - you may have to do it the hard way.Pete
Or take a look at MediaPlayer, or if you need to do it really low level, perhaps use this for inspiration: dranger.com/ffmpegPete
videoview implements mediaplayer, therefore i think this will not work. thank you for the inspiration, i will have a look!alex_muc

1 Answers

5
votes

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/