[vlc-devel] [RFC PATCH] mediacodec: fix a deadlock when seeking on pause
tom at gllm.fr
Wed Oct 29 09:55:50 CET 2014
On Wed, Oct 29, 2014, at 09:44, Martin Storsjö wrote:
> On Tue, 28 Oct 2014, Thomas Guillem wrote:
> > MediaCodec with direct rendering can be stuck waiting for an input buffer when
> > video is paused. Indeed, input buffers availability depends on output buffers.
> > When the video is paused, output buffers are not released or displayed anymore,
> > therefore, no more input buffers are available.
> > A previous hack was made in order to fix a deadlock when mediacodec was stuck
> > and when exit was requested. Mediacodec returned an invalid picture after a
> > small delay, then DecoderIsExitRequested in DecoderDecodeVideo was checked and
> > this decoder could be exited without blocking.
> > This previous hack didn't fix a deadlock when a paused video was flushed, due
> > to a seek. Indeed, when stuck, mediacodec is feed with the same block.
> > Therefore it won't receive a new block containing the FLUSH flags and it will
> > be stuck returning an invalid picture.
> > One (ugly) way to fix this deadlock is, when you return an invalid_picture, to
> > put the block in an internal FIFO and tell the core decoder that the block is
> > processed. This way, new blocks will be given on next Decode calls and the
> > Decoder will be able to handle a flush block. If the decoder is stuck when
> > paused and resumed again, the Decode function will first process the block that
> > come from the internal FIFO. There will be no discontinuity at all.
> I'm a little hesitant. Doesn't this mean that while paused, the decoder
> would (slowly) buffer up all later video packets in the file? So if you
> keep the player paused for a little longer while, you'd end up with
> the whole file in memory? And once you start playing, there's no way to
> reduce the length of the fifo (you only remove one packet from the FIFO
> when you get a new one) other than seeking, or am I missing something?
I did some test, The internal mediacodec fifo won't be feed with the
There will be a transfer between the core decoder fifo and the internal
Input buffers size will stay the same. Blocks will just be dispatched
between the core decoder fifo and the mediacodec internal fifo.
You're right for the last point, I only remove one packet from the
internal FIFO at a time, I'm improving the patch to fix that.
> // Martin
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
More information about the vlc-devel