[vlc-devel] [PATCH 0/3] Android MediaCodec direct rendering

Felix Abecassis felix.abecassis at gmail.com
Fri Nov 15 15:47:18 CET 2013


Implementation of direct rendering for Android MediaCodec.

Requires:
https://github.com/mstorsjo/vlc-android/commit/43a8a1c217717e5dba627dea46a6900c72d43244.patch

Current issue: on some devices (e.g. Nexus 5) the video blocks after
decoding the first frame.  Because of preroll buffering, the vout
attempts to retrieve several pictures before starting to display them.
Depending on the number of output buffers available, it is not always
possible for the decoder to provide that much pictures. Since the
pictures are not displayed, the output buffer are not released; as a
result the decoder becomes blocked in the DecodeVideo function without
being able to get either an available input or output buffer.  We
have several options to solve this issue:

1) If we fail at getting an available input or output buffer after N
attempts, we invalidate the oldest picture and release its buffer. The
enclosed patch provides a mechanism for invalidating pictures from the
decoder. Unfortunately on Nexus 5 we are dropping too much pictures
and thus the video is not entirely smooth.

2) Similarly, after N unsuccessful attempts we can send dummy pictures
(not attached to an output buffer) down the pipeline to unblock the
vout.

3) Dig more into the core to find a more general solution that will
also benefit other potential decoders with a similar async behavior.

The first two options are feeling too hacky so I will look into 3).

Felix Abecassis (3):
  mediacodec: change type of internal variables to bool.
  fourcc: add entry for Android opaque buffer type.
  mediacodec: implementation of MediaCodec direct rendering based on the
        work by Martin Storsjö.

 include/vlc_fourcc.h                     |   3 +
 modules/codec/Makefile.am                |   2 +-
 modules/codec/omxil/android_mediacodec.c | 232 ++++++++++++++++++++++++++-----
 modules/video_output/Modules.am          |   1 +
 modules/video_output/android/surface.c   |   3 +
 src/misc/fourcc.c                        |   3 +-
 6 files changed, 209 insertions(+), 35 deletions(-)

-- 
1.8.3.2




More information about the vlc-devel mailing list