<div dir="ltr"><div><div><div><div><div>On Nexus 5, the issue is that the decoder need to have 5 pictures simultaneously in flight during the initial buffering and this seems impossible on this device.<br></div>The maximum size of the fifo is defined by the following macro:<br>
#define DECODER_MAX_BUFFERING_COUNT (4)<br></div>Why 4? Is there a reason?<br></div>If the number of pictures becomes greater than this value we use a condition variable to signal this change and buffering is disabled for the rest of the video.<br>
<br></div>To solve this issue, we should be able to change this maximum size when opening a decoder module. I suggest adding a member to decoder_t and assigning it a default value of 4 while allowing modules to override this value.<br>
</div>I've sent the patch for review.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/11/15 Felix Abecassis <span dir="ltr"><<a href="mailto:felix.abecassis@gmail.com" target="_blank">felix.abecassis@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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"><div class="im"><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><font color="#888888"><br></font></span></blockquote><div><br></div></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><span class="HOEnZb"><font color="#888888"><br>
<br clear="all">
<br>-- <br>Félix Abecassis<div><a href="http://felix.abecassis.me" target="_blank">http://felix.abecassis.me</a></div>
</font></span></div></div>
</blockquote></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>