[vlc-devel] [PATCH] codec: avcodec: rework for readframe loop

Francois Cartegnie fcvlcdev at free.fr
Thu Jun 22 15:16:50 CEST 2017


Le 22/06/2017 à 14:47, Ilkka Ollakka a écrit :
> On Thu, Jun 22, 2017 at 02:24:15PM +0200, Francois Cartegnie wrote:
> 
> Hi,
> 
>> diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
>> index 5bf2b67..65e9ea7 100644
> 
>>  /*****************************************************************************
>>   * DecodeBlock: Called to decode one or more frames
>>   *****************************************************************************/
>> -static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block, bool *error )
>> +static int DecodeBlock( decoder_t *p_dec, block_t **pp_block, bool *error )
> 
> You return VLC_EGENERIC/VLC_SUCCESS but you don't check it at all?

Because we don't make difference between critical and temporary errors.

>>  static int DecodeVideo( decoder_t *p_dec, block_t *p_block )
>>  {
>>      block_t **pp_block = p_block ? &p_block : NULL;
>> -    picture_t *p_pic;
>> +
>>      bool error = false;
>> -    while( ( p_pic = DecodeBlock( p_dec, pp_block, &error ) ) != NULL )
>> -        decoder_QueueVideo( p_dec, p_pic );
>> +    DecodeBlock( p_dec, pp_block, &error );
>> +
>>      return error ? VLCDEC_ECRITICAL : VLCDEC_SUCCESS;
> 
> Should this also take into an account DecodeBlock return-value?

It wasn't and should not. Only a fatal error should stop feeding or
draining.

Francois


More information about the vlc-devel mailing list