Commit 555ba2d1 authored by Martin Storsjö's avatar Martin Storsjö Committed by Jean-Baptiste Kempf

omxil: Push a dummy buffer on the input buffer fifo to avoid deadlocks

By pushing a sentinel/dummy buffer on the input buffer fifo
when the output needs reconfiguring, we avoid deadlocks on
HTC Sensation, where the input buffers aren't returned to
the caller until the decoder has been reconfigured.

Since all input buffers can be used up before the reconfigure event
is received, this earlier led to a deadlock where the decoder
waited for the caller to reconfigure it (as a response to the
reconfigure event), while the caller waited for an input buffer
to be freed to put the next input packet into.
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 944c1c4e
......@@ -1111,6 +1111,10 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
/* Send the input buffer to the component */
OMX_FIFO_GET(&p_sys->in.fifo, p_header);
if (p_header && p_header->nFlags & OMX_BUFFERFLAG_EOS)
goto reconfig;
if(p_header)
{
p_header->nFilledLen = p_block->i_buffer;
......@@ -1147,6 +1151,7 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
*pp_block = NULL; /* Avoid being fed the same packet again */
}
reconfig:
/* Handle the PortSettingsChanged events */
for(i = 0; i < p_sys->ports; i++)
{
......@@ -1453,6 +1458,9 @@ static OMX_ERRORTYPE OmxEventHandler( OMX_HANDLETYPE omx_handle,
for(i = 0; i < p_sys->ports; i++)
if(p_sys->p_ports[i].definition.eDir == OMX_DirOutput)
p_sys->p_ports[i].b_reconfigure = true;
memset(&p_sys->sentinel_buffer, 0, sizeof(p_sys->sentinel_buffer));
p_sys->sentinel_buffer.nFlags = OMX_BUFFERFLAG_EOS;
OMX_FIFO_PUT(&p_sys->in.fifo, &p_sys->sentinel_buffer);
break;
default:
......
......@@ -111,4 +111,6 @@ struct decoder_sys_t
date_t end_date;
int i_nal_size_length; /* Length of the NAL size field for H264 */
OMX_BUFFERHEADERTYPE sentinel_buffer;
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment