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

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

2013/11/15 Rémi Denis-Courmont <remi at remlab.net>

> If the hardware (driver) does not provide enough picture for decoding,
> then you are screwed, period. Depending on the codec (and profile), you
> need a certain minimum number of concurrent pictures.
> If however you are merely waiting for pictures to free up, then it might
> just mean you are not keeping track of them correctly. Note that the video
> output prepare and display callbacks bear little to no relevance to the
> picture references. A single picture may be displayed more than once (for
> instance when paused), or never (due to frame skip or preroll).

I don't think that's the issue. It looks like no pictures are being
displayed before the decoder has returned N pictures.
If N is greater that the number of MediaCodec output buffers then the
decoder is called repeatedly but it can neither accept an input block nor
return a frame since all the output buffers are currently associated with
pictures that are currently in flight.
The only way for the decoder to make progress is to release output buffers
by displaying or skipping frames.
By returning fake pictures, the pictures associated to real buffers will
start getting displayed (or skipped), freeing some buffers and unblocking
the decoder.

Another way to solve this issue is to apply the following patch (by Martin)
in decoder.c:


@@ -1391,12 +1391,13 @@ static void DecoderPlayVideo( decoder_t *p_dec,
picture_t *p_picture,

         DecoderWaitUnblock( p_dec, &b_reject


         if( p_owner->b_buffering && !p_owner->buffer.b_first


             vlc_mutex_unlock( &p_owner->lock




         bool b_buffering_first =


@@ -1415,8 +1416,8 @@ static void DecoderPlayVideo( decoder_t *p_dec,
picture_t *p_picture,

         if( b_buffering_first


-            assert( p_owner->buffer.b_first
-            assert( !p_owner->buffer.i_count
+//            assert( p_owner->buffer.b_first
+//            assert( !p_owner->buffer.i_count
             msg_Dbg( p_dec, "Received first picture"
             p_owner->buffer.b_first =
             p_picture->b_force =

Félix Abecassis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20131115/dd406a19/attachment.html>

More information about the vlc-devel mailing list