[vlc-devel] [PATCH 5/5] omxil: Make sure i_channels is nonzero before dividing by it
Martin Storsjö
martin at martin.st
Fri Feb 1 13:10:58 CET 2013
At startup of the decoder, i_channels might be set to 0 if the decoder
hasn't processed the sent CODECCONFIG data yet. (In these cases, the
returned buffers are 0 bytes long so we don't miss anything either.)
A port reconfigure event is sent in these cases, so i_channels gets
initialized to the right value before we handle any later buffers with
actual content.
---
modules/codec/omxil/omxil.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c
index c15197a..b0d423b 100644
--- a/modules/codec/omxil/omxil.c
+++ b/modules/codec/omxil/omxil.c
@@ -1513,12 +1513,13 @@ block_t *DecodeAudio ( decoder_t *p_dec, block_t **pp_block )
/* Take care of decoded frames first */
while(!p_buffer)
{
- unsigned int i_samples;
+ unsigned int i_samples = 0;
OMX_FIFO_PEEK(&p_sys->out.fifo, p_header);
if(!p_header) break; /* No frame available */
- i_samples = p_header->nFilledLen / p_sys->out.p_fmt->audio.i_channels / 2;
+ if (p_sys->out.p_fmt->audio.i_channels)
+ i_samples = p_header->nFilledLen / p_sys->out.p_fmt->audio.i_channels / 2;
if(i_samples)
{
p_buffer = decoder_NewAudioBuffer( p_dec, i_samples );
--
1.7.10.4
More information about the vlc-devel
mailing list