[vlc-devel] [RFC PATCH 1/5] filter: add a way to signal error from callbacks

Thomas Guillem thomas at gllm.fr
Thu Feb 28 21:29:55 CET 2019



On Thu, Feb 28, 2019, at 20:08, Rémi Denis-Courmont wrote:
> Hi,
> 
> This requires that callbacks are all serialized, which I don't think that's a good idea for extensibility and generality.
> 
> And then I don't think filters should be allowed to fail after initialisation, as it won't typically be possible or reasonable to handle errors.

My last patch of the set really need to make sure we handle filters fails, but yes those fail are very unlikely:
Few filters check external API returns and fail accordingly. I guess these checks could be replaced by asserts and make extra precaution it won't fail from the open CB.
And what about alloc fail ? I guess if it happens for a small block, we are screwed anyway.


> 
> Le 28 février 2019 17:59:50 GMT+02:00, Thomas Guillem <thomas at gllm.fr> a écrit :
>> TODO:
>>  - document for video/spu
>>  - Check if all filters are loaded with error = false include/vlc_filter.h | 9 ++++++++-
>>  src/misc/filter.c    | 1 +
>>  2 files changed, 9 insertions(+), 1 deletion(-)
>> 
>> diff --git a/include/vlc_filter.h b/include/vlc_filter.h
>> index b2a8f871a4..4822de7771 100644
>> --- a/include/vlc_filter.h
>> +++ b/include/vlc_filter.h
>> @@ -83,12 +83,19 @@ struct filter_t
>>      /* Filter configuration */
>>      config_chain_t *    p_cfg;
>>  
>> +    /** Set to true to signal an error from any callbacks */
>> +    bool                error;
>> +
>>      union
>>      {
>>          /** Filter a picture (video filter) */
>>          picture_t * (*pf_video_filter)( filter_t *, picture_t * );
>>  
>> -        /** Filter an audio block (audio filter) */
>> +        /**
>> +         * Filter an audio block (audio filter)A
>> +         * @return a valid output block or NULL (if the module need more data
>> +         * to output a block). Set filter_t.error to true to signal an error.
>> +         */
>>          block_t * (*pf_audio_filter)( filter_t *, block_t * );
>>  
>>          /** Blend a subpicture onto a picture (blend) */
>> diff --git a/src/misc/filter.c b/src/misc/filter.c
>> index 465677a12f..678b88965e 100644
>> --- a/src/misc/filter.c
>> +++ b/src/misc/filter.c
>> @@ -148,6 +148,7 @@ int filter_ConfigureBlend( filter_t *p_blend,
>>      p_blend->fmt_out.video.i_visible_width  = i_dst_width;
>>      p_blend->fmt_out.video.i_height         =
>>      p_blend->fmt_out.video.i_visible_height = i_dst_height;
>> +    p_blend->error = false;
>>  
>>      /* */
>>      if( !p_blend->p_module )
> 
> -- 
> Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté. 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20190228/c1232f65/attachment.html>


More information about the vlc-devel mailing list