<div dir="ltr">2013/11/15 Rémi Denis-Courmont <span dir="ltr"><<a href="mailto:remi@remlab.net" target="_blank">remi@remlab.net</a>></span><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

If the hardware (driver) does not provide enough picture for decoding,<br>
then you are screwed, period. Depending on the codec (and profile), you<br>
need a certain minimum number of concurrent pictures.<br>
<br>
If however you are merely waiting for pictures to free up, then it might<br>
just mean you are not keeping track of them correctly. Note that the video<br>
output prepare and display callbacks bear little to no relevance to the<br>
picture references. A single picture may be displayed more than once (for<br>
instance when paused), or never (due to frame skip or preroll).<span class=""><font color="#888888"><br></font></span></blockquote><div><br></div><div>I don't think that's the issue. It looks like no pictures are being displayed before the decoder has returned N pictures.<br>

</div><div>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.<br>

The only way for the decoder to make progress is to release output buffers by displaying or skipping frames.<br>By returning fake pictures, the pictures associated to real buffers will start getting displayed (or skipped), freeing some buffers and unblocking the decoder.<br>

<br></div><div>Another way to solve this issue is to apply the following patch (by Martin) in decoder.c:<br>--- a/src/input/decoder.c                                                                    <br>+++ b/src/input/decoder.c                                                                    <br>

@@ -1391,12 +1391,13 @@ static void DecoderPlayVideo( decoder_t *p_dec, picture_t *p_picture,<br>         bool b_reject;                                                                      <br>                                                                                             <br>

         DecoderWaitUnblock( p_dec, &b_reject );                                             <br>-                                                                                            <br>+/*                                                                                          <br>

         if( p_owner->b_buffering && !p_owner->buffer.b_first )                              <br>         {                                                                                   <br>             vlc_mutex_unlock( &p_owner->lock );                                             <br>

             return;                                                                         <br>         }                                                                                   <br>+*/                                                                                          <br>

         bool b_buffering_first = p_owner->b_buffering;                                      <br>                                                                                             <br>         /* */                                                                               <br>

@@ -1415,8 +1416,8 @@ static void DecoderPlayVideo( decoder_t *p_dec, picture_t *p_picture,  <br>         /* */                                                                               <br>         if( b_buffering_first )                                                             <br>

         {                                                                                   <br>-            assert( p_owner->buffer.b_first );                                              <br>-            assert( !p_owner->buffer.i_count );                                             <br>

+//            assert( p_owner->buffer.b_first );                                            <br>+//            assert( !p_owner->buffer.i_count );                                           <br>             msg_Dbg( p_dec, "Received first picture" );                                     <br>

             p_owner->buffer.b_first = false;                                                <br>             p_picture->b_force = true;                                                      <br></div></div><br><br clear="all">

<br>-- <br>Félix Abecassis<div><a href="http://felix.abecassis.me" target="_blank">http://felix.abecassis.me</a></div>
</div></div>